Php4 and php5 on Centos6 with cPanel/WHM
PHP4 deprecated (and do not remove php5 ) on centos with cpanwel/whm
We describe how to use both php4 and php5 on the Centos server
Install additional packages:
yum groupinstall "Development tools" yum install httpd-devel bzip2-devel gmp-devel yum install perl libcurl-devel yum install gmp-devel
Download php4 sources from http://php.net/releases/
cd /usr/local/src wget http://museum.php.net/php4/php-4.4.9.tar.gz tar –xfv php-4.4.9.tar.gz cd php-4.4.9
Configure:
./configure --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu --target=i686-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --without-pear --with-bz2 --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --without-sqlite --with-libxml-dir=/usr --enable-xml --with-system-tzdata --with-apxs2=/usr/sbin/apxs --with-mysqli=/usr/bin/mysql_config --without-gd --disable-dom --disable-dba --without-unixODBC --disable-pdo --disable-xmlreader --disable-xmlwriter --without-sqlite3 --disable-phar --disable-fileinfo --disable-json --without-pspell --disable-wddx --with-curl --disable-posix --disable-sysvmsg --disable-sysvshm --disable-sysvsem
If you get error like:
Sorry, I cannot run apxs. Possible reasons follow: 1. Perl is not installed 2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs 3. Apache was not built using --enable-so (the apxs usage page is displayed)
Check is installed or/and: You probably should change the --with-apxs2=/usr/sbin/apxs to --with-apxs2=/usr/bin/apxs Then use /usr/bin/apxs2 instead of /usr/sbin/apxs. But we've builded w/o these changes.
If you get error like this:
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
Than check is libcurl-devel installed. Alternate: Find where curl includes locates on your server with find / -name “curl*”. Change the line in build config from –with-curl to --with-curl=/opt/curlssl/include/curl
For any other build errors check this link: http://crybit.com/20-common-php-compilation-errors-and-fix-unix/
Once configuration succeed:
make make install
Copy php4 module:
cp /usr/local/src/php-4.4.9/.libs/libphp4.so /usr/local/apache/modules/
Add to httpd.conf (if you on Centos w/o cPanel/WHM) this line:
LoadModule php4_module modules/libphp4.so
In case of cPanel/WHM installed you need to modify the apache conf in the next way:
Main >> Service Configuration >> Apache Configuration >> Include Editor Post VirtualHost Include
Or
/usr/local/apache/conf/includes/post_virtualhost_global.conf
and add the line specified above
Create .htaccess or add the next lines if this file already exists in public_html folder:
AddType application/x-httpd-php .php .php4 .php3 .phtml .tpl .html
That's all! You can check if everything working fine by creating the phpinfo.php file in public_html folder with next content:
<?php // Show all information, defaults to INFO_ALL phpinfo(); ?>
""