How to downgrade PHP version on Heroku - php

I've been having issues with my webapp ever since heroku upgraded to PHP 7.2.0. How can I downgrade to a 7.0.* version of PHP on heroku?

Heroku currently supports PHP 5.6, 7.0, 7.1 and 7.2.
You can select your runtime in your composer.json file, e.g.
{
"require": {
"php": "^7.0"
}
}
to select the latest version of PHP 7.0.

A little gotcha, make sure you commit in the composer.lock file after setting the php version in your composer.json:
composer update

Related

Phalcon Fatal error: Class 'Phalcon\Mvc\Application' not found in

I have this file directory:
When I open this project in browser: Fatal error: Class 'Phalcon\Mvc\Application' not found in...
I read that I have to install composer but when I install composer this errors occure:
How can I run my project?
My composer.json file consists:
"require": {
"phalcon/incubator-mailer": "^1.0",
"smi2/phpclickhouse": "^1.4",
"hybridauth/hybridauth": "^3.8"
}
}```
There are in fact two problems.
You are missing the phalcon php extension. You can find the instructions on how to install the extension in the official Phalcon documentation.
You need at least php version 7.3 to satisfy the requirements of smi2/phpclickhouse. Since php 7.x is EOL since 26th of November 2022, I'd strongly suggest to upgrade to the latest version which currently is php 8.1.
Once you resolved the two problems, composer install should run successfully, and the missing classes should be placed in the vendor directory.
Following up on some of the other comments, Phalcon 4 is NOT compatible with PHP 8.1. Phalcon 4 requires PHP 7.4.
If you plan on running PHP 8.1, you will need to install Phalcon 5.1.1.
You can find the Phalcon installation documentation on at https://phalcon.io

trying to install mpdf using composer, but getting version ^6.1?

I am trying to install mpdf using composer, but when I try command_prompt "composer require mpdf/mpdf" in my project folder, I get version 6.1 installed instead of 7.x. Any suggestions?
Windows 11
XAMPP v3.3.0
Any help appreciated!
command prompt screen shot
This can work like this because of php version installed locally. latest version of mpdf or its dependencies can require the specific version of php or its extensions or smth else. If you're not going to run your code locally, you can cpecify target php and exts versions int you composer.json like this:
{
"require": {
"php": "~7.4.0",
"ext-gd": "*",
"ext-mbstring": "*"
}
}
You may not get the latest lib version but you will get version that will work on your target system

Does Laravel 5.2 support PHP 7.2

I have project developed in Laravel 5.2 version. But now I want to upgrade only PHP version to 7.3 So can anyone let me know that if Laravel 5.2 works with PHP latest versions.
I want laravel version to be unchanged but with latest PHP version that is PHP 7.2+
It is highly recommend to upgrade your Laravel version in this case as Laravel 5.2 supports PHP version between 5.5.9 - 7.1.* as per documentation but if you have concerns you can tweak the php version to 7.2 and test if its works.
To change the php version just add below code to your composer.json file.
"config": {
"platform": {
"php": "7.2"
}
}
after that run composer update if you get any error you can always revert it back by tweaking the version again in composer.json file

magento 2 composer installation issue in xampp with php 7.3.2

I just tried to install Magento 2 on my local server Xampp
I installed the composer and when tried to run composer install in command prompt , I got a error
amzn/amazon-pay-and-login-with-amazon-core-module 3.2.9 requires php 7.1.3- 7.2.0 your php version 7.3.2 doesn't satisfy that requirment.
How can I resolve this issue?
The current version of the amzn/amazon-pay-and-login-with-amazon-core-module package requires PHP version 7.2. You're on PHP version 7.3.2 which is not supported by version 3.2.9 of the package (yet).
You have multiple options to resolve the issue:
Downgrade to PHP 7.2.x to match the package's requirements.
Try to install a newer version of the package or directly from the master branch.
If the compatibility with PHP 7.3 has been added to the package's composer.json i.e. in a newer version or on the master branch you can use:
# install the master branch
composer require 'amzn/amazon-pay-and-login-with-amazon-core-module:dev-master'
# install a version greater than 3.2.9
composer require 'amzn/amazon-pay-and-login-with-amazon-core-module:~3.2.10'
Ignore the PHP version requirement for a single composer install with:
composer install --ignore-platform-reqs
Override the PHP version in your composer.json.
"config": {
"platform": {
"php": "7.2.21"
}
}
This way all subsequent runs of composer install|update will resolve the PHP to version 7.2.21.

How to use PHP 5.6 (or later) on cloudControl?

I have a Symfony 3.0 application that I want to deploy on cloudControl. The app is running on the pinky stack; my composer.json requires PHP >=5.5.9
"require": {
"php": ">=5.5.9",
...
}
When I try to push, I get
...
-----> WARN: No php version found in composer.json. Falling back to legacy build.
...
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.5.9 but your PHP version (5.4.45) does
not satisfy that requirement.
The phpinfo() of the pinky stack shows, that PHP 5.6.12 is running.
How do I have to modify my composer.json (or any other file in my application) to make this run in PHP 5.6?
There is a blog post, about how to use specific PHP versions and extensions.
http://www.paasfinder.com/custom-php-version/
Since all systems are 64bit, you have to use e.g.:
{
"require": {
"php-64bit": "5.6.12"
}
}

Categories