Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Restoring PHP to a previous version

Posted on 2013-06-06
12
Medium Priority
?
565 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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 111

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 111

Accepted Solution

by:
Ray Paseur earned 2000 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 111

Expert Comment

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

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

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.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

722 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