Archive for the ‘PHP’ category

Install SSH2 for PHP

October 16th, 2009
wget http://downloads.sourceforge.net/project/libssh2/libssh2-1.2.1.tar.gz?use_mirror=softlayer
 tar -zxvf libssh2-0.12.tar.gz
 cd libssh2-0.12
./configure && make all install

Run the pear installer for PECL/ssh2:

pear install ssh2

If this installing via pear fails,

wget http://pecl.php.net/get/ssh2-0.11.0.tgz
 tar -zxvf ssh2-0.11.tgz
 cd ssh2-0.11
 phpize && ./configure --with-ssh2 && make

Copy ssh2.so to /usr/local/lib/php/extensions/no-debug-non-zts-20020429.

 cp modules/ssh2.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429

Add extension=ssh2.so to /usr/lib/php.ini
Run service restart httpd to enable these changes.

Horde – Fatal error: Call to undefined method Registry::hasInterface() in /usr/local/cpanel/base/horde/config/prefs.php on line 134

September 28th, 2009

Fatal error: Call to undefined method Registry::hasInterface() in
/usr/local/cpanel/base/horde/config/prefs.php on line 134

If you are using the Turkish language in Horde, you may want to utilize English, if at all possible, due to a bug in PHP 5.2 which will not be resolved until PHP 6.

http://bugs.php.net/bug.php?id=35050

Roundcube hangs when sending mail

September 27th, 2009

In recent builds of roundcube, you may find that you can’t send mail using Roundcube. If /var/cpanel/roundcube/log/errors shows the following:


[30-Jan-2009 14:07:11] Invalid response code received from server (421):
[30-Jan-2009 14:07:11] Invalid response code received from server (-1):
[30-Jan-2009 14:07:34 -0800] SMTP Error: SMTP error: Authentication failure: STARTTLS failed (Code: ) in /usr/local/cpanel/base/3rdparty/roundcube/program/steps/mail/func.inc on line 1248 (POST /3rdparty/roundcube/index.php?_task=mail&_action=send)
[30-Jan-2009 14:10:29] STARTTLS failed ():

Then there is an issue with the most recent Net-SMTP PHP module. To resolve this, edit the following file:


/usr/local/cpanel/base/3rdparty/roundcube/config/main.inc.php

and change

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u';

to this:


// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '';

suphp 500 error, Premature end of script headers

September 26th, 2009


[Sat Sep 26 22:02:33 2008] [error] [client 111.222.333.444] Premature end of script headers: phpinfo.php
[Sat Sep 26 22:02:33 2008] [error] [client 111.222.333.444] File does not exist: /home/username/public_html/500.shtml

First step: ensure that you’re using proper permissions on your files for suphp. Your php files should have 644 permissions, and ownership of the user whose home folder the files are in.

If ownership and permissions are correct, it could be a memory issue. I’ve found that some users who experience this error are running out of available memory for php to execute properly. You can try switching your PHP handler to cgi or fcgi, which will actually display an “out of memory” error in apache’s error_log, but suphp will not.


[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] Premature end of
script headers: php5
[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] File does not exist:
/home/username/public_html/500.shtml
[Sat Sep 26 08:48:02 2009] [error] [client 111.222.333.444] Out of memory

If you do have available RAM, but PHP isn’t able to use it, try increasing the RLimit value in httpd.conf and see if your script will execute then. If you look at “free” and you don’t have much free memory, you may need to upgrade your server or VPS.