Search code examples
phpgoogle-compute-enginebitnami

Downgrade from PHP 7 to PHP 5.6 on apache server


I just recently launched LAMP version 7.0 using bitnami on google app engine.

I couldn't find the older version of 5.6.

Any idea how i can downgrade the default PHP 7 to PHP 5.6 on my server

upon running this commandphp --version

i get this output

PHP 7.0.22 (cli) (built: Sep 6 2017 14:14:52) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.22, Copyright (c) 1999-2017, by Zend Technologies

kindly note that i have also installed PHP 5 using sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

but the dafault PHP version remains PHP 7.0.22


Solution

  • Bitnami Stacks are self-contained. That means that they include every component they need (e.g. Apache, PHP, PHP-FPM, MySQL, etc.).

    Those components are not installed using the System Package Manager of the Distro (e.g. yum on Centos or apt on Debian). Therefore, if you install a different version of PHP on your Image, you'll have two different PHPs installed. The one in the system and the one in the Stack. However, every component included in the Stack will use the PHP included in the Stack (no matter what version you installed in the system).

    You can find the PHP in the LAMP Stack at /opt/bitnami/php. If you want to use PHP 5.X you have several options:

    • A. Download and install the LAMP Stack with PHP 5.6.x from https://bitnami.com/stack/lamp/installer on your server. After that, remove the previous LAMP Stack with PHP 7.
    • B. Install PHP using the System Package Manager. Then, modify the environment to remove /opt/bitnami/php from the PATH and also edit the file /opt/bitnami/scristps/setenv.sh to avoid including /opt/bitnami/php again in the PATH.