Linux-PHP4cgiAndPHP5on CentOS5
WARNING: The data on the server were damaged due to the fire in Hosting.UA DC. All files will be restored shortly.
IntroductionAs you know, CentOS5 is being shipped with PHP5 which, especially, is being installed in ISAPI mode and thus makes the installation of additional PHP4 modules not available. The solution is to run PHP4 in CGI mode. So, to get it working CGI mode we have to:
Well, I did so and was very upset - PHP wasn't working as expected. Problems with UTF-8 encoding, unexpected sigfaults and other staff made this approach useless. Fortunately, I found that the issue is already solved by LabCoding team, here is the article. Anyway, there was one major thing which wasn't satisfying me. Their package is being installed into the standard OS folders and was causing conflicts with some of my existing files. So, I decided to rebuild the PHP4 RPM packages to make PHP4 being installed into /opt/php4 directory and thus to make it separated from the entire filesystem. How does it work?Package php4-4.4.8-LAB4 installs php4 binaries into opt/php4/bin folder. Also, other files are being installed into /opt/php4/etc/, /opt/php4/lib/, /opt/php4/share/ folders. Extensions are being installed into /opt/php4/lib/php4 directory and their configurations - into /opt/php4/etc/php.d. To get PHP4 working we have to set up a CGI handler set to process *.php files using /opt/php4/bin/php4-cgi binary. Installation and Configuration
[conforge]
name=Conforge package for CentOS $releasever - $basearch
baseurl=http://repo.conforge.com/conforge/CentOS/$releasever/$basearch
enabled=1
gpgcheck=0More info about Conforge repository is available here.
~# yum install php4 php4-pear php4-mysql
~# yum install php4*
ScriptAlias /php-bin/ /opt/php4/bin/
SetEnv PHPRC "/opt/php4/bin"
Action php4-script "/php-bin/php4-cgi"
AddHandler php4-script .phpNOTE: In case you will do that for global server then you will turn off PHP5 support at all.
AddDefaultCharset windows-1251
~# /etc/init.d/httpd reload Created by: admin last modification: Friday 09 of April, 2010 [11:59:57 UTC] by admin |
Login |