-3

I'm running symfony 1.2 in my live server and php 5.2 which doesn't have composer install.

I run composer locally and uploaded all the vendor files to live server but the extension which i downloaded via composer has code difference i.e it doesn't sync with old version of php! My extension/plugin code is in php latest version and my live server php is old i.e 5.2 So how can i fix this? any idea?

Thanks

  • 2
    For the love of all that is holy, upgrade PHP! – AbraCadaver Jul 09 '18 at 15:33
  • @AbraCadaver the thing is it's a big project and it's in old php version! So how can you recommend this upgrade? Rewrite will be an option! – Dev Troubleshooter Jul 09 '18 at 15:34
  • @DevTroubleshooter if it's an option, backup the project to a dev server and upgrade that. See how much breaks. – Richard Jul 09 '18 at 15:35
  • 1
    OR downgrade your local PHP to 5.2 and then run the composer stuff so you (hopefully) get 5.2 compatable code from composer – RiggsFolly Jul 09 '18 at 15:44
  • 1
    Your best bet of course is to install 5.2 on your development machine. However, you can set the php version which composer uses in your composer.json. Lots of potential problems but it might work. – Cerad Jul 09 '18 at 16:16
  • Composer will not work on PHP 5.2: https://stackoverflow.com/questions/21530797/how-can-i-install-composer-for-php-5-2 – Don't Panic Jul 09 '18 at 16:31
  • 1
    The extension that you installed with composer is highly unlikely to work on PHP 5.2. A lot has changed since then. – Don't Panic Jul 09 '18 at 16:33

1 Answers1

0

You can restrict your composer packages by php minor version using something like that on your composer.json require section

"php": "~5.2.0",

and you can define the php version with the platform setting with

"config": {

    "platform": {
        "php": "5.2"
    }

},

You should also use the same php version on your dev environment

Composer will then download the latest versions of each package that supports the specified php version

But with such older versions you might have issues

And make sure to point out to your supervisors that this project needs to be updated to a supported php version asap. Especially if it is mission critical or has sensitive data in it

Dimitris
  • 433
  • 3
  • 13