• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

PHP5 Support allong with PHP4 (Tutorial)

N

nick7233

Guest
The following are the steps I took to get php5+gd+mysql support (in parallel with the default install of php) working with my Plesk hosted sites on FC2. Hopeful it might help someone else.


mkdir /usr/local/php5libpng
cd /usr/local/php5libpng

wget http://kent.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz
gunzip libpng-1.2.8-config.tar.gz
tar -xvf libpng-1.2.8-config.tar

(remove extra dirs created by the unzipping)

./configure '--prefix=/usr/local/php5libpng' '--exec-prefix=/usr/local/php5libpng'
make
make install


yum install mysql-devel
yum install libjpeg-devel


mkdir /usr/local/php5
cd /usr/local/php5

wget http://uk2.php.net/get/php-5.1.2.tar.gz/from/uk.php.net/mirror
gunzip php-5.1.2.tar.gz
tar -xvf php-5.1.2.tar

(remove extra dirs created by the unzipping)

./configure '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--prefix=/usr/local/php5' '--exec-prefix=/usr/local/php5' '--program-suffix=5' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-exif' '--enable-ftp' '--with-curl' '--with-bz2' '--enable-memory-limit' '--enable-inline-optimization' '--with-openssl' '--with-png' '--with-regex=system' '--with-xml' '--with-zlib' '--enable-sockets' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--with-zlib' '--with-png-dir=/usr/local/php5libpng' '--with-gd' '--with-jpeg-dir=/usr/local/php5libjpeg' '--enable-gd-native-ttf' '--with-mysql'

make
make install


Create the file /home/httpd/vhosts/example.com/conf/vhost.conf with the following in it for each site:

ScriptAlias /php5-cgi-custom /home/httpd/vhosts/example.com/httpdocs
Action application/x-httpd-php5-custom "/php5-cgi-custom/php5"

Run: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com


Create a .htaccess file with the following in the directories that need to be run by php5:

AddType application/x-httpd-php5-custom .php


For each of the sites go to the base httpdocs directory (after sshing in as the site user, not root): /home/httpd/vhosts/example.com/httpdocs/ and run cp /usr/local/php5/bin/php5 ./php5

Then chmod php5 to 755 (php5 needs to be copied and run locally, since otherwise you get issues with suexec. If you have problems run cat /var/log/httpd/suexec_log and check any errors.


PHP5 should now work.
 
Ive got PHP 5.0 rpms for FC2/3/4, rh9, CentOS3/4, and Rhel 3/4 in my [atomic-testing] channel, and PHP 5.1 packages in the [atomic-bleeding] archive. I'll probably be moving PHP 5 into the main [atomic] archive in the next few weeks.
 
Originally posted by atomicturtle
Ive got PHP 5.0 rpms for FC2/3/4, rh9, CentOS3/4, and Rhel 3/4 in my [atomic-testing] channel, and PHP 5.1 packages in the [atomic-bleeding] archive. I'll probably be moving PHP 5 into the main [atomic] archive in the next few weeks.

Hey scott, are there any known issues with the 5.1 rpms for el4 aside from app valut packages (i.e. with Horde)?
 
What about the error I was getting on all the App vault progs? Where is wants php 4.x but fails cause 5 is installed?
 
Greetings!

psa v8.0.1_build80060903.14 os_CentOS 4.2

Looks like I'm having a compile problem. I've got no real experince in compiling.

I issued the command
./configure '--prefix=/usr/local/php5libpng' '--exec-prefix=/usr/local/php5libpng'

I got this error
checking for zlibVersion in -lz... no
configure: error: ZLib not installed

did a "locate zlib"

[root@server libpng-1.2.8-config]# locate zlib
/lib/modules/2.6.9-34.EL/kernel/lib/zlib_deflate
/lib/modules/2.6.9-34.EL/kernel/lib/zlib_deflate/zlib_deflate.ko
/lib/modules/2.6.9-42.0.2.EL/kernel/lib/zlib_deflate
/lib/modules/2.6.9-42.0.2.EL/kernel/lib/zlib_deflate/zlib_deflate.ko
/usr/lib/python2.3/lib-dynload/zlibmodule.so
/usr/lib/python2.3/encodings/zlib_codec.py
/usr/lib/python2.3/encodings/zlib_codec.pyo
/usr/lib/python2.3/encodings/zlib_codec.pyc
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/zlib.ph
/usr/share/doc/zlib-1.2.1.2
/usr/share/doc/zlib-1.2.1.2/README

Also tried a "apt-get install zlib" got a interesting reply. It's supposidly already installed and some major psa conflicts. :(


Reading Package Lists... Done
Building Dependency Tree... Done
zlib is already the newest version.
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
psa: Obsoletes: psa-mailman-configurator but 8.0.1-centos4.2.build80060613.20
is to be installed
Obsoletes: psa-hotfix1 but 8.0.1-centos4.2.build80060618.11 is to be inst
alled
Obsoletes: psa-hotfix2 but 8.0.1-centos4.2.build80060713.16 is to be inst
alled
Obsoletes: psa-hotfix4 but 8.0.1-centos4.2.build80060728.17 is to be inst
alled
Obsoletes: psa-hotfix5 but 8.0.1-centos4.2.build80060903.14 is to be inst
alled
psa-api-rpc: Obsoletes: psa-agent but 1.4.1-80060613.20 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a s
olution).
 
I got this error
checking for zlibVersion in -lz... no
configure: error: ZLib not installed
[/B]

You need the zlib-devel package ;-)

It doesn't work with SuSE 9.3, I have a lot of compiling problems with the PHP 5.1.6 package. Any Hints...?

cheers
Tom
 
These instructions are AWESOME! Thank you SO much. I'm actually running Plesk 8.1, but with some small changes, almost everything is working great. We actually had already been running PHP5 and needed to add PHP4 functionality again.

One small problem, though... Everything looks great, except when I make a PHP call from my browser...

----
Warning: Unexpected character in input: '' (ASCII=15) state=1 in /var/www/vhosts/valley-technologies.com/httpdocs/php4 on line 1122

Warning: Unexpected character in input: ' in /var/www/vhosts/valley-technologies.com/httpdocs/php4 on line 1122

Warning: Unexpected character in input: ' in /var/www/vhosts/valley-technologies.com/httpdocs/php4 on line 1122

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/valley-technologies.com/httpdocs/php4 on line 1122
----

The funny thing is, I can run "./php4 test.php4" and get the proper output.

Any ideas on this one?
 
God bless Google. In case anyone else is having the problem I WAS having, simply re-compile PHP as above, but drop the '--enable-discard-path' part.

Boom, everything works great!
 
php4 as a side of php5

You can install php4 as a side of php5 in Linux plesk server .
So the .php extension files will take php5 as default php and .php4″ extensions will take php4 as default php . You can also set the default php as php4 for a particular domain.

Note: Current running php is php5 in the server .So we dont touch the php5 settings

You could also able to set php4 as default php of a domain
If you wish this type of configuration please follow the link below ,

-------------
http://sherin.in/?p=30
------------
 
HELP

HELP!!! I followed the above link and now I get a script 500 on the webpage. Even with something as simple as phpinfo();

In the error log all I get is Premature end of script headers: php

Permissions seem correct on the everything... not sure whats going on. Could someone plese help? This only happens with php4 files, php runs on php5 and runs fine but I have to have php4 working asap.

I ran a test of the page directly through php command line and it ran fine. Seems to only have problems when its ran through the web.

[Tue Jul 17 20:43:39 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:40 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:40 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:40 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:41 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:41 2007] [error] [client 76.168.29.89] Premature end of script headers: php
[Tue Jul 17 20:43:41 2007] [error] [client 76.168.29.89] Premature end of script headers: php


ect....
 
PHP5+GD+MySQL Support allong with PHP4 in Plesk 8.2.0/RHEL 4

Hi,

Thanks for the tutorial; this is a Great Post for installing PHP5 (GD+MySQL) along with default PHP 4. Although I have modified some steps to install in RHEL 4 with Plesk 8.2.0. I am updating the steps below it might help someone else.

You need to follow only one complete instruction (nick7233 or Mine) when installing PHP5.

1.1. Install GD support for PHP5.

a) # mkdir /usr/local/php5libpng
b) # cd /usr/local/php5libpng
c) # wget http://kent.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz
d) # tar -zxvf libpng-1.2.8-config.tar
e) # ./configure --prefix=/usr/local/php5libpng --exec-prefix=/usr/local/php5libpng
f) # make
g) # make install

1.2. Check for this packages or install it.

mysql-devel
libjpeg-devel

1.3. Download and Install PHP.

a) # mkdir /usr/local/php5
b) # cd /usr/local/php5
c) # wget http://museum.php.net/php5/php-5.1.4.tar.gz
d) # tar -zxvf php-5.1.2.tar

e)# ./configure --host=i386-redhat-linux --build=i386-redhat-linux --target=i386-redhat-linux-gnu --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --program-suffix=5 --enable-force-cgi-redirect --enable-discard-path --enable-exif --enable-ftp --with-curl --with-bz2 --enable-memory-limit --enable-inline-optimization --with-openssl --with-png --with-regex=system --with-xml --with-zlib --enable-sockets --enable-mbstring=shared --enable-mbstr-enc-trans --with-png-dir=/usr/local/php5libpng --with-gd --with-jpeg-dir=/usr/local/php5libjpeg --enable-gd-native-ttf --with-mysql --with-gmp --with-iconv --enable-magic-quotes --enable-calendar --enable-dbx --enable-dio --enable-libxml --enable-session --with-pcre-regex --enable-xml --enable-simplexml --enable-spl --enable-sigchild --enable-soap --enable-zend-multibyte --with-kerberos=/usr/kerberos --enable-fastcgi

f) # make
g) # make install

2. Now go to the root folder of the domain and configure php5 as default php application. Create the file vhost.conf with the following in it for each site running in PHP5:

a) # cd /var/www/vhosts/domain-name/conf/
b) # vi vhost.conf and add the following lines.

AddHandler fcgid-script .php5 .php
SuexecUserGroup <ftp user> psacln
<Directory /var/www/vhosts/domain-name/httpdocs>
FCGIWrapper /var/www/vhosts/domain-name/bin/php5 .php
FCGIWrapper /var/www/vhosts/domain-name/bin/php5 .php5
Options ExecCGI
allow from all
</Directory>
Save and exit with ":wq".

Note1: for replacing string in vi editor use the command: [:n,$s/string/newstring/g] - Where 'n' will replace with the starting line NO.


c) # cd /var/www/vhosts/domain-name/
d) # mkdir bin
e) # chown ftpuser.psaserv bin
f) # cd bin
g) # cp /usr/local/php5/bin/php5 php5
h) # chown ftpuser,psacln php5
i) # chmod 755 php5 (optional if the permission is wrong)

Note2: PHP5 needs to be copied and run locally, since otherwise you get issues with suexec. If you have problems run cat /var/log/httpd/suexec_log and check any errors.

3. Reconfigure domain with PHP5

a) Run: # /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com
b) # service httpd restart

Recheck with "phpinfo" as it is properly configure or not.

------------------------------------------------------------------------------



Local Server Installation:
in a Non-Plesk Server

4.0.0. Now configure the same in a Non Plesk Environment. Run the step One (download and compile the PHP 5).

4.1.0. Now you can configure in a way so that only the file with .php5 extension will run through PHP 5.

4.1.1.
# vi /etc/httpd/conf/httpd.conf, and add this lines.

# Enabling PHP 5 as CGI Application

ScriptAlias /php5 /usr/local/php5/bin
<Directory /usr/local/php5/bin/>
Options +ExecCGI +FollowSymLinks
AllowOverride All
</Directory>
AddType application/x-httpd-php-5 .php5
Action application/x-httpd-php-5 /php5/php


4.1.2. # service httpd restart

4.2.0. Alternatively you can use port base configuration, so that the file with .php extension with this option e.g. http://domain.com/test.php runs with PHP4 and for http://domain.com:88/test.php with PHP 5.

4.2.1. # vi /etc/httpd/conf/httpd.conf, add these lines.

# Coustom Port for PHP 5
Listen 88

# VirtualHost PHP 5 Based hosting

<VirtualHost _default_:88>
ScriptAlias /php5 /usr/local/php5/bin
<Directory /usr/local/php5/bin/>
Options +ExecCGI +FollowSymLinks
AllowOverride None
</Directory>
AddHandler php-cgi-script .php
Action php-cgi-script /php5/php
Options +ExecCGI
</VirtualHost>


4.2.2. # service httpd restart


I have tested, it is working fine in all my Plesk Server (Plesk 8.2.0/RHEL 4).

You need to follow only one complete instruction (nick7233 or Mine) when installing PHP5.


Thanks & Regards,
Ankur - Diadem Suport
 
Hey, following the guide link showed by both nick7233 and diadem.support, I have successfully installed PHP5 on the VPS-plesk server, I am just stucked with the next step i.e:

-------------------
2. Now go to the root folder of the domain and configure php5 as default php application. Create the file vhost.conf with the following in it for each site running in PHP5:

a) # cd /var/www/vhosts/domain-name/conf/
b) # vi vhost.conf and add the following lines.

AddHandler fcgid-script .php5 .php
SuexecUserGroup <ftp user> psacln
<Directory /var/www/vhosts/domain-name/httpdocs>
FCGIWrapper /var/www/vhosts/domain-name/bin/php5 .php
FCGIWrapper /var/www/vhosts/domain-name/bin/php5 .php5
Options ExecCGI
allow from all
</Directory>
Save and exit with ":wq".

Note1: for replacing string in vi editor use the command: [:n,$s/string/newstring/g] - Where 'n' will replace with the starting line NO.

c) # cd /var/www/vhosts/domain-name/
d) # mkdir bin
e) # chown ftpuser.psaserv bin
f) # cd bin
g) # cp /usr/local/php5/bin/php5 php5
h) # chown ftpuser,psacln php5
i) # chmod 755 php5 (optional if the permission is wrong)

Note2: PHP5 needs to be copied and run locally, since otherwise you get issues with suexec. If you have problems run cat /var/log/httpd/suexec_log and check any errors.

3. Reconfigure domain with PHP5

a) Run: # /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com
b) # service httpd restart

Recheck with "phpinfo" as it is properly configure or not.
-------------------

When I restart HTTP, I get the error as below:

[root@server conf]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: Syntax error on line 4 of /var/www/vhosts/mycharitypage.com/conf/vhost.conf:
Invalid command 'FCGIWrapper', perhaps mis-spelled or defined by a module not included in the server configuration
[FAILED]



Please explain this steps in details please....
 
Hi,

For installing PHP5 which configure option you used? nick7233 or diadem.support.

You need to follow only one complete instruction (nick7233 or diadem.support) don't mix it. I have configured the PHP5 to working as Fast-CGI/CGI mode.

Regds,
Diadem
 
Back
Top