Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upgrade more than 50 installations to PHP 5.3 [closed]

as web designers we had a good year 2011 with more than 50 (different) cms & other php 5.2 driven applications. Some had customizations to core as well. How does someone upgrade such amount of apps to php 5.3?

Do developers of php ever thought about that? Much (popular) functions are just depreciated causing a lot of work to people like us.

I really don't know how to best proceed

like image 340
Grashopper Avatar asked May 10 '12 16:05

Grashopper


People also ask

Is PHP 5.2 still supported?

Users running PHP 5.2 on their sites. Why is this happening? PHP has not supported version 5.2 since 2011 and there are many unpatched security vulnerabilities.

Is PHP 5.4 still supported?

PHP 5.4 end-of-life date is September 14, 2015.


1 Answers

The short answer

It depends.

The strategy for migration would be influenced by the quality and content of the source itself, as well as the architecture and workflow. There is no "silver bullet" to make it work.

Longer answer

How it should be done

You automatically upgrade all the staging sites, run all the unit tests and if they all pass - run the acceptance tests. Fix the issues that arise till you can pass all the tests. Then let your QA people make sure that everything is really 100% OK. This whole process would mostly run by your continuous integration system/framework.

When all works on the staging environment, you take down each site for maintenance, deploy the updated code to the production environment, upgrade the server's software, and bring the sites back up.

How you will (most likely) HAVE to do it

Since none of your software has any unit/acceptance tests, no up-to-date specification, or even notion of continuous integration system, you will have to do it the hard way:

'step 1' take a survey of different servers setups on which your projects 
         are deployed (if you have all project on single box with 
         virtual-hosts, you can skip this bit )
'step 2' find somewhere a computer, which can temporary act as local server
<foreach setup>

    'step 3' install/configure this temporary server to be exactly like 
             the "setup"
    <foreach project on that setup>

        'step 4' BACKUP ALL THE STUFF
        'step 5' copy the latest source and DB from the production server
        'step 6' upgrade the software
        'step 7' see what has *blown* up and fix what you can find    
        'step 8' pass to the QA team 
        'step 9' store the source

    </endforeach project>
    'step 10' take the server with this configuration down for maintenance
    'step 11' upgrade software on the server
    'step 12' deploy all the projects from this server 
    'step 13' prayer (optional)

<endforeach setup>

This is kinda the "brief" version. Basically you will have to go server-by-server, clone it locally, then upgrade, patch projects. Then upgrade each server and put the patched version on. And hope.

Should you upgrade ?

Clients will not pay for this.

Since you have ~50 different projects, you would have to investigate if it's even worth the time and money. After such analysis you might discover that it would make more sense for a business to mark most of the projects as "legacy" and just upgrade server(s) to latest 5.2.x. Then leave it alone.

Of course even if you decide to not upgrade most of the projects, there will be some that will require it. Particularly project with ongoing contracts, which generate a steady stream of income for the company.

I would recommend to start upgrading those cash-cow projects, because you will have to anyway. And then from this experience you can calculate the costs for the rest of your "portfolio".

What about next time ?

PHP 5.4 is out (at the time of last edit, 5.5 is already coming). Most companies by the end of this year will be faced with a question: "Is it time to start using 5.4 ?". Some sooner, some a bit later. The frameworks and CMSs, that you use, too have a tendency to get updates.

Bottom line: your company as whole should start to investigate ways to streamline this process.

And what about when you upgrade to PHP 5.5 and mysql_* functions start showing E_DEPRECATE warnings? See the red box in mysql_affected_rows() documentation. This is not a one-time thing.

It might be wise to invest in implementing better deployment strategy (something that involves unit-tests and continuous integration).


<rant>

Do developers of php ever think about that? Many (popular) functions are just depreciated causing a lot of work to people like us.

The functions and functionality, that has been deprecated, has been marked as such in documentation for ages. For example, the notice, that ereg() and passing object by reference should not be used, has been there since I began learning PHP. The deprecation warnings would affect mostly PHP4 codebase (in which case, your question is a bit disingenuous).

I do not see how enforcing practices, which have been accepted in the community for years, is "causing a lot of work".

</rant>

like image 108
tereško Avatar answered Sep 20 '22 14:09

tereško