PHP

Basic LAMP Performance Tuning

Linux:
(2.6 kernel only)
Check vm.swappiness: sysctl -A|grep swap
The default is 60, which is generally too high... if it is still the default, set it to 20:

sysctl -w vm.swappiness=20
echo "vm.swappiness = 20" >> /etc/sysctl.conf

Submitted by jkelly on Thu, 2007-07-05 19:14. categories [ | | | | ] read more

Testing PHP mail

Here is a script you can use to verify php mail is functioning... you need to change the to and from address variables appropriately.

$to_address="your@email.com";
$from_address="user@server.com";

$body="Test message";

$headers = "From: $from_address \r\n";
$headers.= "Content-Type: text/plain; charset=ISO-8859-1 ";
$headers .= "MIME-Version: 1.0 ";

Submitted by jkelly on Wed, 2007-06-20 19:18. categories [ | ] read more

Resolving Horde webmail issues with PHP 5

Upgrading to PHP 5 can create some unfortunate issues with Horde webmail. While the version of Horde provided by Plesk is technically PHP 5 compliant, the version of PEAR packaged with Horde contains a DB module that is NOT PHP 5 compliant, which causes miscellaneous and sundry issues with Horde. Here is a quick fix:

pear upgrade DB
cp -a /usr/share/pear/DB.php /usr/share/pear/DB/ /usr/share/psa-horde/pear/

Unfortunately, due to openbasedir restrictions, a straight "cp" is the cleanest solution. Once this is complete, Horde should function properly (still not sure if this resolves everything).

Submitted by jkelly on Sat, 2006-08-26 06:16. categories [ | | ]

Per domain open basedir restrictions

Sometimes it is necessary to relax the open basedir restrictions for a particular domain. To do this, you'll need to create a vhost.conf for that domain, or edit the existing one. For this example, we will use 'test.com' as the domain.

vi /var/www/vhosts/test.com/conf/vhost.conf

<Directory /var/www/vhosts/test.com/httpdocs>
    php_admin_flag engine on
    php_admin_value open_basedir [insert appropriate restrictions here, or 'none' to disable]
</Directory>

/usr/local/psa/admin/bin/websrvmng -av

And there you have it.

Submitted by jkelly on Sat, 2006-08-12 09:39. categories [ | | ]

Creating a PHP info page

All you need to do is paste the following into a file in a web-content directory (typically phpinfo.php or info.php):

<?php
phpinfo();
?>

Submitted by jkelly on Fri, 2006-08-11 10:44. categories [ | ] 1 attachment
Syndicate content