HELP! My production site is down due to failed deployment - outdated PHP
My forge server was running PHP 7.1.4 and I deployed code that I did not know required PHP 7.2. The code I was deploying had changes to composer.json and composer.lock
This failed deployment caused my site to go down. I believe this to be true as my other sites on the same server are still up and running.
I attempted to upgrade PHP 7.2 using Laravel Forge's "Upgrade to PHP 7.2" button. The button now shows "Upgrade to PHP 7.3". However when I try to re-deploy the code, I am getting the same error. Doing php -v after SSHing into my forge server confirms that 7.1.4 is still the PHP version that is running. I tried restarting the server and restarting PHP via Laravel Forge and still no luck.
How do I revert a failed deployment to get my production site up and running?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/dbal v2.10.0 -> satisfiable by doctrine/dbal[v2.10.0].
- doctrine/dbal v2.10.0 requires php ^7.2 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 2
- Installation request for doctrine/lexer 1.2.0 -> satisfiable by doctrine/lexer[1.2.0].
- doctrine/lexer 1.2.0 requires php ^7.2 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 3
- Installation request for mews/purifier 3.1.3 -> satisfiable by mews/purifier[3.1.3].
- mews/purifier 3.1.3 requires php ^7.2 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 4
- Installation request for symfony/css-selector v5.0.1 -> satisfiable by symfony/css-selector[v5.0.1].
- symfony/css-selector v5.0.1 requires php ^7.2.5 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 5
- Installation request for symfony/mime v5.0.1 -> satisfiable by symfony/mime[v5.0.1].
- symfony/mime v5.0.1 requires php ^7.2.5 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 6
- Installation request for symfony/service-contracts v2.0.1 -> satisfiable by symfony/service-contracts[v2.0.1].
- symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 7
- Installation request for symfony/translation-contracts v2.0.1 -> satisfiable by symfony/translation-contracts[v2.0.1].
- symfony/translation-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.1.4) does not satisfy that requirement.
Problem 8
- symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.1.4) does not satisfy that requirement.
- symfony/console v4.4.1 requires symfony/service-contracts ^1.1|^2 -> satisfiable by symfony/service-contracts[v2.0.1].
- Installation request for symfony/console v4.4.1 -> satisfiable by symfony/console[v4.4.1].
I was able to revert my code back and my site is back up and running. However my Laravel Forge still reports I have PHP 7.2 installed. But as you can see from the error message above, it is still running PHP 7.1.4 I would still like to push my new commit which requires PHP 7.2
some computer languages allow concurrent installation of different versions and the user has to choose when one. Someone here knows this better than I do, but I think with php it enabling and disabling modules. Look on the Web to see if you have to disable a php module or an apache module.
This has solved itself. It looks like upgrading PHP on Forge just takes time. Even though Forge is reporting the upgrade has been successful, it takes some time before it actually takes effect and composer recognizing it.