Solved

Restoring PHP to a previous version

Posted on 2013-06-06
12
558 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 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

15 Experts available now in Live!

Get 1:1 Help Now