How do I downgrade php from 5.4 to 5.3 in CentOS?
2014-03
I have a webserver running CentOS 6. Yesterday, I installed php-gd with yum install php-gd
because I couldn't see graphics on my website. However, when I see my php version, it changed from 5.3 to 5.4x.
Because my application uses register_globals
(which was removed from php 5.4), I cant even log in to my app.
I tried two ways to downgrade my php:
- Using yum again to downgrade; this wouldn't downgrade to 5.3x, just 5.4x
- Downloading the php rpm directly; I messed this up, and wound up with dependency hell.
Why not simply fix your code - According to http://ubuntuforums.org/showthread.php?t=1973028 add the following to the top of your PHP script -
foreach ($_REQUEST as $key=>$val) { ${$key}=$val; }
(And ask yourself why you are running insecure code).
Apparently you can even automate this further by adding an "auto_prepend_file" directive to a .htaccess file to make it work for the entire directory in 1 hit.
if i try to install php-mysql I get the following error... not sure how to recover from it to get MySQL and the PHP MySQL module up and running
[12:51]~> yum install php-mysql
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: mirror.rocketinternet.net
* base: mirror.san.fastserv.com
* epel: mirrors.kernel.org
* extras: mirror.nic.uoregon.edu
* ius: www.applesauceman.com
* updates: mirror.5ninesolutions.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-mysql
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: php-mysql
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: php-mysql
--> Running transaction check
---> Package mysql.x86_64 0:5.0.77-4.el5_5.4 set to be updated
---> Package php-common.x86_64 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Conflict: mysql conflicts MySQL
--> Finished Dependency Resolution
mysql-5.0.77-4.el5_5.4.x86_64 from updates has depsolving problems
--> mysql conflicts with MySQL-server-community
Error: mysql conflicts with MySQL-server-community
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
You'll need to install the shared compatibility libraries package from the same place that you got the server package first.