Archive for February 2011

How to upgrade php 5 on a windows plesk Server

You can upgrade the version of php on windows plesk server through the following steps

1) Download the php Binaries of the version which you want to upgrade

2) Stop the plesk services on the server

3) Goto the path D:\parallels\plesk\additional\pleskphp5

rename pleskphp5 to oldpleskphp5 and create a new folder named

pleskphp5 and extract the php binaries in it . Delete the php.ini file in it and   copy the php.ini file from oldpleskphp5 and paste it in the new

D:\parallels\plesk\additional\pleskphp5  path

4) Goto Server , Server Components and click Refresh .

Thats it , you will see the upgraded version of PHP

How to enable Custom php.ini for PHP FCGI

If you want to enable custom php.ini settings for PHP FCGI on your server then follow the below steps :

1 > Create a .htaccess file under the directory : /home/username/public_html

[email protected][#] cd /home/username/public_html
[email protected][/home/username/public_html]# vi .htaccess

And the below two lines at the top :

AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi

save and quit.

2 > go to the cgi-bin directory : /home/username/public_html/cgi-bin

[email protected][#] cd /home/username/public-html/cgi-bin

and then copy the default php.ini here

[email protected][#] cp /usr/local/lib/php.ini /home/username/public_html/cgi-bin/

3 > Create php.fcgi file to load custom php.ini

Please note that you should still be in /home/username/public_html/cgi-bin location.

[email protected][/home/username/public_html/cgi-bin] # vi php.fcgi

and then add the below code :

exec /usr/local/cpanel/cgi-sys/php5

save and quit.

Now make the file php.cgi executable:

[email protected][/home/username/public_html/cgi-bin] # chmod + x php.fcgi

4 > Change ownership of files to correct user:

[email protected][/home/username/public_html/cgi-bin] chown username.username * -R

And if it still does not work for you then follow the below steps as well :

5 > Add paths to php.conf file

[email protected][#] vi /usr/local/apache/conf/php.conf

and add the below lines :

Action php5-fastcgi /cgi-bin/php.fcgi
AddType application/x-httpd-php .php

save and quit.

and after adding the above two lines the php.conf file should look like this :

[email protected][/usr/local/apache/conf] # cat php.conf

# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/
MaxRequestsPerProcess 500
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
Action php5-fastcgi /cgi-bin/php.fcgi
AddType application/x-httpd-php .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml

# End of autogenerated PHP configuration.

6 > Distill and rebuild Apache, then restart Apache

[email protected][#] /usr/local/cpanel/bin/apache_conf_distiller –update
[email protected][#] /scripts/rebuildhttpdconf
[email protected][#] /etc/init.d/httpd restart

And finally to test if the custom php.ini is working follow the steps :

[email protected][#] cd /home/username/public_html

[email protected][/home/username/public_html]# vi info.php

Add the below lines :

< ?php

save and quit.

Change the ownership of info.php file to user:user

[email protected][/home/username/public_html]# chown username:username info.php

Now browse the URL :

And search for the line : Loaded Configuration File

Loaded Configuration File /home/username/public_html/cgi-bin/php.ini

That’s all you are done.