LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 11-15-2013, 09:09 AM   #1
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Rep: Reputation: Disabled
How to revert to previous version of PHP?


I'm using Slackware 12.1 on a production server. Now I want to upgrade PHP from version 5.2.12 to version 5.5.6. Since this is a production server, I must be able to revert to the previous PHP version in case the upgrade fails. How can I perform the upgrade while still retaining the old version AND how do I revert to the previous version of PHP? On the internet I can find some information about this topic, but not specifically for Slackware.
 
Old 11-15-2013, 04:55 PM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 755

Rep: Reputation: 226Reputation: 226Reputation: 226
I would expect that upgrade to fail as it is a pretty big version jump.

Slackware 12.1 has a php-5.3.27 package as the most up to date version and even that carries a warning.

As for your situation if you still have a copy of the old version package you will be able to reinstall it if the new version doesn't work with your scripts.

I would however set up a test box somewhere else and copy the server data over and test it out on different versions and see how much work your looking at to update the scripts so they work with a more recent and supported version of php.

Consider using a VM setup to host test machines.
 
Old 11-15-2013, 05:18 PM   #3
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,656

Rep: Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570
Quote:
Originally Posted by Pindakaas View Post
I'm using Slackware 12.1 on a production server. Now I want to upgrade PHP from version 5.2.12 to version 5.5.6. Since this is a production server, I must be able to revert to the previous PHP version in case the upgrade fails. How can I perform the upgrade while still retaining the old version AND how do I revert to the previous version of PHP? On the internet I can find some information about this topic, but not specifically for Slackware.
I agree, that is a very big version bump.

But be aware that upgrading PHP itself is usually not sufficient for the web server to continue working.

Apache modules that build against PHP must also be recompiled, as will any other packages compiled against the original PHP.
 
Old 11-16-2013, 01:41 PM   #4
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wildwizard View Post
I would however set up a test box somewhere else and copy the server data over and test it out on different versions and see how much work your looking at to update the scripts so they work with a more recent and supported version of php.
This is a long story. I have already set up 3 test boxes without any fruitful results. The first setup was with ESXi where I made a clone of the production server. That didn't work because I was unable to correctly bootstrap Slackware within the virtual environment. In the second setup I installed Slackware 12.1 from scratch in ESXi. That failed because the connection to the ESXi server kept disconnecting and I couldn't find a working solution for this despite contacting VMWare. In the last test setup I used VirtualBox and installed Slackware 12.1 from scratch. Then I recompiled the new PHP and installed it. The new PHP seems to work fine in this environment. However, this is only a simulation and is no guarantee that it will work like this on the production server.

I do not understand why you speak of a big version bump. Suppose I have PHP 3 and want to upgrade to PHP 5.5. Why is it not possible to replace PHP 3 with PHP 5.5? I'm pretty sure Slackware allows the removal of PHP 3. After that it must be possible to install PHP 5.5, right?

Last edited by Pindakaas; 11-16-2013 at 01:43 PM. Reason: added: "The new PHP seems to work fine in this environment."
 
Old 11-16-2013, 04:19 PM   #5
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 755

Rep: Reputation: 226Reputation: 226Reputation: 226
PHP changes the way it handles various things internally when you bump the major version number.

This can and does stop scripts from working until they are rewritten with the new version's methods in mind.

If you can show that all your scripts will still work with the new version and the output from them is the same as when they run under the old version then you will be able to upgrade.
 
Old 11-16-2013, 05:49 PM   #6
arsivci0
Member
 
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 14.1
Posts: 61

Rep: Reputation: 7
Quote:
Originally Posted by Pindakaas View Post
I do not understand why you speak of a big version bump. Suppose I have PHP 3 and want to upgrade to PHP 5.5. Why is it not possible to replace PHP 3 with PHP 5.5? I'm pretty sure Slackware allows the removal of PHP 3. After that it must be possible to install PHP 5.5, right?
Slackware will not fight you. If you have the 3.x and 5.x packages handy, upgradepkg will up and downgrade all the same. The problem is how and where you used php. Those scripts written a la 3.x may not work in 5.x or whatever.

So, you should check all scripts, web pages and whatever in a production machine before an upgrade.
 
Old 11-16-2013, 07:45 PM   #7
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by arsivci0 View Post
So, you should check all scripts, web pages and whatever in a production machine before an upgrade.
Exactly. That is exactly what I am trying to do. There are 2 safe solutions to my problem:
- create an environment where the new PHP and the old PHP can run simultaneously as described here (but I don't know how to do that with Slackware)
- create an environment where only one version of PHP is active, but you can switch to another version quickly.

Both solutions I cannot get to work because I know too little about Slackware. Can you tell me how to get one of the two solutions to work?
I have a virtual test environment (VirtualBox) ready to implement one of the two solutions. If all goes well, then I implement the safe solution in the production environment and everything should be fine.

By the way, I am using checkinstall to create a PHP package for me before I install it.
 
Old 11-16-2013, 10:16 PM   #8
ljb643
Member
 
Registered: Nov 2003
Posts: 264

Rep: Reputation: Disabled
The instructions in your link to running multiple PHP versions are quite complex. And even if it works, it isn't really the same setup (FastCGI, PHP-FPM) as your production setup, so it doesn't seem to me to be a good way to test alternate PHP versions.

The ideal way, as others posted, is to have a test server, loaded with the same Slackware version, and a separate version of PHP. But I understand that isn't always possible or practical.

There is another way to get multiple PHP versions on the same server, and it isn't very hard. You run 2 instances of Apache, listening on different ports, nearly identical configuration except for which PHP module they load. I've done this under Slackware and it works. I'm using the supplied Slackware Apache, but I build my own PHP's from source. You can probably use this method with the stock PHP-5.4.x from Slackware, but you will still need to build your own from source for the other versions (5.5.x or 5.3.x for example). Specify a different --prefix for each version when configuring.

You also need to be using web pages and applications that don't botch the port number: they must include the request port on any URLs they build internally, etc. A well behaved system should work well on any port.

I'm not sure you're interested in the details, but I can follow up if you are. In brief, I changed these lines in the httpd config file for the second instance: Listen (specify the new port), ErrorLog and CustomLog (need unique log file names), PidFile (need a unique name), and LoadModule php5_module (specify the full path to the other libphp5.so). Also don't do "make install" on the other PHP, or it will overwrite the Apache module. (Or, just save the module first, make install, then put the new one somewhere else and restore the original.) You start the second Apache with something like: httpd -f /etc/httpd/other-httpd.conf -k start
 
Old 11-17-2013, 02:00 AM   #9
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
I'm not sure you're interested in the details, but I can follow up if you are.
I'm very much interested in the details. Can you explain it in simple steps for me? I've never installed anything in Slackware before except installing PHP in the test environment for this project.
 
Old 11-17-2013, 08:57 PM   #10
ljb643
Member
 
Registered: Nov 2003
Posts: 264

Rep: Reputation: Disabled
Oh. I was hoping you would say you are experienced in building and configuring things on Slackware. This isn't really something to try out on a production server, but it's your server and your risk, so here goes. It works for me on Slackware 14.0, Slackware PHP-5.4.x, and self-built PHP-5.5.x, but I don't know about your Slackware 12.1 and PHP-5.2.x.

Get php-5.5.6.tar.bz2 from php.net and unpack into any directory:
Code:
$ tar -xjf php-5.5.6.tar.bz2
$ cd php-5.5.6
Configure php. You must adjust the configure command to account for your choice of paths and which features and extensions you need. The paths you choose must not conflict with those used by the Slackware package. This is an example only, with no optional extensions:
Code:
$ ./configure --prefix=/opt/php --with-layout=GNU --with-apxs2 --disable-cgi --with-config-file-path=/opt/php/etc
$ make
Do not use make install, or it will overwrite the Apache PHP module installed with Slackware. Instead, you want to do everying "make install" does except for "make install-sapi". Then manually copy the PHP module (libphp5.so) somewhere.
Code:
$ su
# make install-modules install-binaries install-build install-headers
# make install-programs install-pharcmd
# cp .libs/libphp5.so /opt/php/lib/
Make a php.ini file - either use your existing file or the supplied template.
Code:
# mkdir /opt/php/etc
# cp php.ini-production /opt/php/etc/php.ini
    OR:
# cp /etc/httpd/php.ini /opt/php/etc/php.ini
Note: If using the template php.ini-production, you need to edit it to set your timezone.

Configure your second Apache instance.
Code:
# cd /etc/httpd
# cp httpd.conf httpd.test.conf
Edit httpd.test.conf and make the following changes:

1) Change the "Listen" line(s) to listen on the new port. Example:
Listen 8080

2) Change the paths in ErrorLog, CustomLog, and/or TransferLog to use filenames that are different, for example:
ErrorLog "/var/log/httpd/test_error_log"
CustomLog "/var/log/httpd/test_access_log" common

3) Change or add a PidFile line to use a unique name. For example:
PidFile "/var/run/httpd.test.pid"
(If adding the line, you can add this right after ServerRoot.)

4) Change the line which loads the PHP module to have the full path. Note: As supplied by Slackware, the PHP module loading is done from a file "mod_php.conf" which is included into httpd.conf. If this is what you have, comment out the line "Include /etc/httpd/mod_php.conf" and replace it with these two lines:
LoadModule php5_module /opt/php/lib/libphp5.so
AddType application/x-httpd-php .php

Now start your second Apache instance:
Code:
#  /usr/sbin/httpd -f /etc/httpd/httpd.test.conf -k start
Check by pointing your browser to http://example.com:8080 - this will get you the same served files but with PHP-5.5.x.

Note: Apache and PHP each have a huge number of configuration options, and some of those might require additional configuration steps to keep two instances of Apache running without conflict.
 
Old 11-18-2013, 04:10 AM   #11
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ljb643 View Post
This isn't really something to try out on a production server, but it's your server and your risk, so here goes.
I'm going to experiment with this first on my virtual test server before I do this on the production server.

Thank you for explaining everything in detail. I wonder, after changing the name of http.conf to http.test.conf, how does the system know that it should use the new filename ? I mean, won't it say "File httpd.conf not found"?
 
Old 11-18-2013, 08:47 AM   #12
ljb643
Member
 
Registered: Nov 2003
Posts: 264

Rep: Reputation: Disabled
Quote:
Originally Posted by Pindakaas View Post
I wonder, after changing the name of http.conf to http.test.conf, how does the system know that it should use the new filename ? I mean, won't it say "File httpd.conf not found"?
You are NOT changing the name. You are making a copy of the file httpd.conf and calling the copy httpd.test.conf. The original Apache instance is unaffected, and the new instance will use the copy.
 
Old 11-18-2013, 08:55 AM   #13
arsivci0
Member
 
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 14.1
Posts: 61

Rep: Reputation: 7
Quote:
Originally Posted by Pindakaas View Post
I'm going to experiment with this first on my virtual test server before I do this on the production server.

Thank you for explaining everything in detail. I wonder, after changing the name of http.conf to http.test.conf, how does the system know that it should use the new filename ? I mean, won't it say "File httpd.conf not found"?
If I were you, I would dump all server files, upgrade and run everything at localhost; oh, not forgetting to subscribe to a good php forum, of course.
 
Old 11-18-2013, 03:14 PM   #14
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,403
Blog Entries: 2

Rep: Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993
Upgrading PHP on a Slackware 12.1 server does not make much sense, since Slackware 12.1 itself is obsolete and soon unsupported:
http://mirrors.slackware.com/slackwa.../ChangeLog.txt
Code:
####################################################################
# NOTICE OF INPENDING EOL (END OF LIFE) FOR OLD SLACKWARE VERSIONS #
#                                                                  #
# Effective December 9, 2013, security patches will no longer be   #
# provided for the following versions of Slackware (which will all #
# be more than 5 years old at that time):                          #
#   Slackware 12.1, Slackware 12.2.                                #
# If you are still running these versions you should consider      #
# migrating to a newer version (preferably as recent as possible). #
# Alternately, you may make arrangements to handle your own        #
# security patches.  If for some reason you are unable to upgrade  #
# or handle your own security patches, limited security support    #
# may be available for a fee.  Inquire at security@slackware.com.  #
####################################################################
I would rather think about upgrading the whole OS instead of just upgrading PHP.
 
Old 11-18-2013, 03:21 PM   #15
Pindakaas
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
Upgrading PHP on a Slackware 12.1 server does not make much sense, since Slackware 12.1 itself is obsolete and soon unsupported:
http://mirrors.slackware.com/slackwa.../ChangeLog.txt
Yeah, thanks for the heads-up.
I will upgrade Slackware and then check if I can use its PHP version.
Is it easy to upgrade Slackware in a production environment? (Should I start a new thread for this question?)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
X11 - how to revert to a previous version cyberjean Linux - Software 3 04-13-2007 04:15 AM
FC5 - Can I revert or install a previous version? Skip-DMP Fedora 3 08-08-2006 12:11 PM
Revert to Previous Kernel Sibre Linux - Software 3 01-17-2006 11:22 AM
How to remove/reinstall OR revert X to a previous version? C38368 Linux - Newbie 1 05-26-2004 02:57 AM
how to revert back to the previous kernel version? prav_284 Red Hat 3 12-10-2003 03:51 AM


All times are GMT -5. The time now is 02:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration