Posts Tagged ‘PHP’

Identifying apache process usage

When apache is running with php as an apache module rather than as a CGI, all processes will run as the apache user.  This makes it a little tricky on a busy multi-site box to identify which sites are using resources and keeping sessions open.  This little command will identify the working directory that the […]

PHP 5.3 big changes!

Lots and lots of things are deprecated!  Probably a good idea to change the error reporting to something like: error_reporting = E_ALL & ~E_NOTICE ~ E_DEPRECATED magic_quotes_gpc,register_globals,safe mode seem to be deprecated Short PHP tags are disabled by default: short_open_tag = On more to come I’m sure…….

Crazy Zend Errors!

Like so: Zend� 2002062301�1�29734�169503�xù Ÿ2 ì½MlgÇu/x›¤ßÉ0 Y|RlÙn·r«n}>=%ÔJ^Ú‹‘”<Ä“1Ãnþ[Í›ìlK­Á´`A›Ù%›L?H XhÀ… kñyÐBh-ò.öh1„EÀ+ƒ0§îg}ž**’¢¸õÿœ[¿:çÔ©SU§ŒSøüﯽ0Û¼9 xÇ´D‘ ÑJUíÜ¿uûæÍ;mnmí÷SxeÜ3ó?Z½ô@÷åŽ,Ëjkvm{w¶ÕOJ÷²)sãOž¼ü7þðÙN½H§ÀzÞ×¾¤¾„¹Žë;þ,úæâ‡Nm „‰êâöþìêáÚ“W¯ÎÀmØ[3C¿¶³wuóp{o×Ì~»{‡k›;;{/϶[û_§ ùúáá­ÿüÛ¿mìÊ•;{‡³«×aùí›WwníÜ>xøw.=ùôåuø¯µõý½µ§ÁöìíÎv×®íí¯]ÚÛ»¹³ùŸÖÈcõc¤Y{¾ðvnÿß7M¾ Ioncube and Zend Optimizer don’t get on.  Ioncube needs to be loaded by PHP first to avoid problems.  Rather than loading them in php.ini, it’s wiser to add their own ini files in /etc/php.d which is then read alphabetically.

xpdf and antiword test scripts

xpdf and antiword test scripts.  xpdf is now part of the poppler and poppler-utils packages <HTML> <BODY> <PRE> <?php $return_code = 0; $result = array(); $error = exec(‘/usr/bin/pdftotext /var/www/vhosts/mydomain.com/httpdocs/xpdftest2.pdf’, $result, $return_code);

PHP sends mail as anonymous@servername

The from address is not enforced.  This can cause some PHP formmail script emails to be treated as spam.  Fix: 1) add a -f(sender address) parameter: mail($to, $subject, $message, $headers, ‘-fsomeone@somewhere.com’); 2) add a Return-Path header: mail($to, $subject, $message, ‘Return-Path: someone@somewhere.com\r\nFrom: someone@somewhere.com’); Qmail is *meant* to check for the from address field in Sender, From, […]

PHP IMAP SSL error

if you are getting a certificate error when using the PHP IMAP function, add the /notls flag: ie: $mbox = imap_open (“{localhost:995/pop3/notls}”, “user_id”, “password”);

PHP file manager not working after upgrading to PHP 5.2

posix is not included with php 5.2 and above do a yum install php-process

osCommerce broken after PHP/MySQL 5upgrade

osCommerce doesn’t seem to be very compatible with MySQL 5 and will most likely generate a load of errors from its SQL statements. Upgrading to the latest version is recommended and should fix this.  For heavily modified versions this may not be posible and will require some hacking to fix: add () to from tables […]

Plesk PHP open_basedir changes

To make a change to PHP for a site in Plesk, such as opening open_basedir, edit /var/www/vhosts/$domain/conf/vhost.conf. You would then add : <Directory /var/www/vhosts/domain.com/httpdocs> php_admin_value open_basedir “/var/www/vhosts/domain.com/httpdocs:/tmp:/THE_PATH_PHP_SCRIPT_TRIES_TO_ACCESS_TO” </Directory> After that, you will need to rebuild the apache configuration with the following command: /usr/local/psa/admin/sbin/websrvmng -v -a

Encrypted email script using GPG and PHP

#First grab the public key into a file for the GPG enabled email address and import it into a new keyring called public_key.gpg mkdir .gnupg to add the keyring files.  Probably outside httpdocs would be a good idea! gpg –no-default-keyring –keyring /var/www/vhosts/secure.mydomain.com/httpsdocs/mydomain.com/.gnupg/public_key.gpg  –import public_key #you can list keys in the keyring by: gpg –no-default-keyring –keyring […]