HELP: Installing PHP 5.2.17 on Unbuntu 12.04 - Almost Done


I recently had Dreamhost upgrade my VPS server from Debian 6 to Ubuntu 12.04 LTS. Everything is working great except for one old forum that requires PHP 5.2.17 (but is currently configured to run on PHP 5.3 and is now broken). This PHP version is so old now that it’s no longer supported on this new server.

I am using the following guide to install PHP 5.2.17 into the server:

It appears that the install of PHP 5.2.17 was successful and the version shows up on my site when I used phpinfo() - but MySQL doesn’t seem to be working, or I may not have it configured properly in the Apache configuration file or the VirtualHost for this site. This is what I have so far for VirtualHost:

[php]<VirtualHost ***.***.***.***:80>
ServerAdmin webmaster@************.com
DocumentRoot /home/************/************.com
ServerName www.************.com
ServerAlias ************.com
DirectoryIndex index.html index.shtml index.htm Index.html Index.htm Index.shtml default.htm Default.htm default.html Default.html default.shtml Default.shtml page1.html index.cgi index.php index.php3 index.phtml home.htm home.html home.shtml index.wml index.pcgi quickstart.html
ErrorLog /home/_domain_logs/************/*****.com/http./error.log
Alias /stats /home/_domain_logs/************/*****.com/http./html
<Directory /home/_domain_logs/**/.com/http./html>
AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes,MultiViews,SymlinksIfOwnerMatch,FollowSymlinks

Alias /doc/analog /usr/share/analog
RewriteEngine on
RewriteMap tolower int:tolower
RewriteMap toupper int:toupper
RewriteMap escape int:escape
RewriteMap unescape int:unescape
RewriteRule ^/dh_phpmyadmin/([^/]
) /dh/web/phpmyadmin/$2
SuexecUserGroup #

<Directory /home/************>
AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes,MultiViews,SymlinksIfOwnerMatch

<Directory /home/************/***********.com>
AddHandler cgi-script .cgi .pl .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
AddHandler php-cgi .php4 .pcgi4
AddHandler php5-cgi .php .php3 .phtml .pcgi .php5 .pcgi5
#RewriteCond %{QUERY_STRING} ../proc/self/environ [NC]
#RewriteRule .
- [F,L]
<Files .php.>
RemoveHandler .php

<Files .php4.>
RemoveHandler .php4

<Files .php5.>
RemoveHandler .php5

AddHandler fcgid-script fcg fcgi fpl
AddHandler fcgid-script .php .phtml .php5 .pcgi5
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .php
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .phtml
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .pcgi
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .php5
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .pcgi5

php_myadmin doesn’t work with php-cgi for some reason.

<Directory /dh/web/phpmyadmin>
EnableSendfile Off
EnableMMAP Off

SecFilterEngine Off

SecRuleEngine Off

AddHandler php5-cgi .php .php3 .phtml .pcgi .php5 .pcgi5

RewriteEngine On
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]

php_value register_globals On

SecFilterEngine On

SecRuleEngine On

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
DeflateMemLevel 5
DeflateCompressionLevel 5

type specifics


AddType application/x-httpd-php .php .php4 .php3 .phtml

php_admin_value open_basedir /dh/web/phpmyadmin:/tmp:/usr/local/lib/php:/home/*****:/home/************

Action php-cgi /cgi-system/php.cgi
Action php5-cgi /cgi-system/php52.cgi
SetEnv dsid *******
SetEnv ds_id_

SetEnv DH_USER ************
CustomLog /dh/apache2/logs/apache2-ps******/mega.log “{ “@timestamp”: “%{%Y-%m-%dT%H:%M:%S%z}t”, “@fields”: { “vhost”: “%v”, “client”: “%a”, “bytes_in”: %I, “bytes_out”: %O, “duration_usec”: %D, “status”: %s, “request”: “%U%q”, “method”: “%m”, “file”: “%f”, “referrer”: “%{Referer}i”, “user”: “************”, “pid”: %P } }” env=!nomega
CustomLog /home/_domain_logs/************/*****.com/http./access.log "%h %l %u %t “%r” %s %O “%{Referer}i” “%{User-agent}i” "
Include /etc/apache2/php52.conf

According to the guide, I changed only these fields:
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .php
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .phtml
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .pcgi
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .php5
FCGIWrapper “/usr/lib/cgi-bin/php52-cgi” .pcgi5

Action php5-cgi /cgi-system/php52.cgi

and included at the bottom:
Include /etc/apache2/php52.conf

Since Dreamhost has it’s directories set up slightly different, I’m not sure if I configured the paths correctly or if there is another issue. I also tried commenting out (extension_dir = “./”") in the php.ini file like those commentators in the guide said, but that didn’t work either.

Any help in finishing this up would be greatly appreciated.

Kind regards

i still wasn’t able to figure this out.

This really isn’t something that we can recommend or provide assistance with.

PHP 5.2 has been unsupported for over five years! It is not safe to use. If you have software that is not compatible with PHP 5.5 or later, it’s time to upgrade (or replace) that software… chances are that, if your software is so old that it isn’t compatible with current versions of PHP, it probably has other security issues of its own as well.

I understand that it’s unsupported, but I still need it to get this site working. It’s an old vBulletin forum and the site needs to be able to work in order for me to login and buy an update for the forum, or so I can sell the site to someone else and they can update it.

Is it not possible to get 5.2.17 working on this server?

If there’s really no way to perform the upgrade without having the site running, your best option is probably to bring up a backup of the site offline with a compatible version of PHP, perform the upgrade there, then copy that back to your live site once it’s compatible with a supported version of PHP.

Nevermind, I just decided to modify the vbulletin forum source code and got it to work with PHP 5.6 at least! I couldn’t quite figure it out with PHP 7 yet, but at least I may be able to update it or sell it now.

Kind regards