Solved

Restoring PHP to a previous version

Posted on 2013-06-06
12
564 Views
Last Modified: 2013-06-07
I made a huge mistake and upgraded my linux server (CentOS).  I'm not ready for the version of php and I need to restore it.  Its in a business environment and I need to get this back to working soon.  I have backups (from three days ago) of the directories and their data.  Would it...could it be as simple as overwriting the php, apache and mysql files (not the databases!) with what I've backed up??

If so...what should look for in replacing for each of these to be sure its back to working??

Please...and thanks to whoever helps me out.  I'm in a state of desperation right now.
0
Comment
Question by:Gabriel7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 1

Expert Comment

by:Uvg
ID: 39228085
You need to specify versions to acquire more help.
It looks like you upgrade to 5.3 from 5.2. In that case you need to remove php 5.3 and install 5.2 from distro repository using standard utilities.
0
 

Author Comment

by:Gabriel7
ID: 39228101
Having difficulty finding it.
0
 
LVL 1

Expert Comment

by:Uvg
ID: 39228178
#yum list php
will list of installed php package

#yum search php
will show available php packages

It seems to me you have php53 package installed. You may remove it and install php package.

Additionally you can use:
#yum downgrade php
To downgrade php package
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:Gabriel7
ID: 39228190
I was thinking about using downgrade, but I wasn't sure if it would damage my databases or what it actually did when it downgraded.  When I ran the process it showed that it was downgrading certain files and deleting others...it was a scary list ...I didn't move forword.  Because I'm guessing I'd have to downgrade apache and mysql at the same time right?
0
 
LVL 1

Expert Comment

by:Uvg
ID: 39228207
No.
You don't need to downgrade apache and mysql in case you have php53 installed and need php package.
But if you want to downgrade php to previous package version - yes. All packages that have a dependency need to be downgraded too. Upgrading and downgrading is safe operations until you use repository from the same version of the OS. Application packages have no relationship with data stored on server.
If you downgrade mysql to previous  version - there will be no problem with data if you still using the same major/minor version of mysql.
For example if use mysql-5.1-<xxx> package you can downgrade to mysql-5.1-<yyy> package safely.
0
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39228636
All you need to do is recompile php from source. I tend to stay away from RPM's when it comes to LAMP. php.net will allow you to download older versions. If you are running RPM's you need to get your config line first. Create a info.php file with:

<?php
phpinfo();
?>

Open in new window


Look under system configuration and copy that to a safe place. Any of the dependancies you would have to download source then compile. PHP does a pretty good job letting you know what it's missing.

Here is my config that is on a PCI complient server:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/php --with-openssl --with-zlib --with-mysql=/usr --with-mysql=/usr/local/mysql --with-curl  --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr  --enable-gd-native-ttf --with-gd

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39228656
Give us a hint, please.  What's not working?  Why do you think you want to downgrade?  There may be other solutions that are far easier.  What are the symptoms of trouble?
0
 

Author Comment

by:Gabriel7
ID: 39229884
Bad programming on the php side.  Things that became deprecated with the newest version.  I need to go through and convert but it wasn't the right thing to do.

The thing that I didn't do that I should have before I upgraded was to create a snapshot (VMWARE)...and god am I kicking myself.

I ended up pulling myself out by grabbing the last snapshot and porting all the data over...but that was just a nasty experience.  

I need to make the sites compatible with the newer php.  Just no easy way of doing that quickly.

Recovered everything (I did try nearly everything on this page, but in the end I was up against a wall).  People started coming in at 6:00.  I got everything that was needed done by 6:13 am.  Haven't slept...
0
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39229909
I feel your pain! One of my systems is in the same boat with old code so I can relate.
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39229968
You can find upgrade-related information in the PHP.net changelogs.  Check the "Migrating From" links in the left side bar.
http://php.net/manual/en/history.php

Things that are deprecated usually continue to work - they just issue "deprecated" messages.  You can suppress these messages (while you work to remove the unwanted dependencies).  Just set the error_reporting() to include ^E_DEPRECATED.

Some things must be remediated.  Two that come to mind are covered in these articles.  But you're probably already past that part, and if you're not, you should prepare yourself because these may require actual programming changes, not just suppression of messages.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_6630-Magic-Quotes-a-bad-idea-from-day-one.html
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7317-Register-Globals-a-bad-idea-from-day-one.html

Is it a good idea to suppress messages?  No, of course not.  It's like putting black electrical tape over the warning light on your dashboard.  Eventually something might go wrong.  But if you suppress the messages you may be able to continue running your server without interruption.  Best regards, ~Ray
0
 

Author Closing Comment

by:Gabriel7
ID: 39230509
Thanks for above and beyond!
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39230772
Thanks for the points, and good luck with the upgrade! ~Ray
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question