Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you change the php version that your app uses in heroku platform?

I am trying to change the PHP version that my heroku application uses from the default 7.1 to 7.0. When I try to define it in composer.json it is ignored. What do I need to do?

like image 960
George Gwaro Avatar asked Mar 08 '23 15:03

George Gwaro


2 Answers

Apart from updating composer file, if your application requires "php": ^5.6.0" or 7.0.32 you need to make sure that, heroku stack that you are using is 'heroku-16' and not 'heroku-18'.

Run heroku stack in CLI to get the info. By default, it is set to 'heroku-18' which is the latest version and uses Ubuntu 18.04 with PHP 7.2 installed.

If it is on 'heroku-18', use command heroku stack:set heroku-16 to toggle.

P.S: PHP versions 5.6 and 7.0 will reach end-of-life at the end of 2018. No bugfixes, including critical security fixes, will be provided by the PHP maintainers after this date. Users are strongly encouraged to update their applications to the latest version of PHP 7.2 at their earliest convenience. For more information on support timelines for PHP releases, refer to the Supported Versions page on the official PHP website.

like image 125
sahil srivastava Avatar answered Apr 28 '23 00:04

sahil srivastava


From Selecting a runtime, you need to use composer.json and specify the PHP version there:

{
  "require": {
    "php": "^5.6.0"
  }
}

In your case, please have:

{
  "require": {
    "php": "7.0.0"
  }
}
like image 21
Soolie Avatar answered Apr 28 '23 00:04

Soolie