Solved

Restoring PHP to a previous version

Posted on 2013-06-06
12
556 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
  • 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
 

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 6

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 108

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 6

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 108

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 108

Expert Comment

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now