How can i downgrade to PHP 5.6 from PHP 7.0

:warning: IMPORTANT, please fill the questions

We assume you are using Bitnami to deploy your application.

  • Which version of the application are you using?:
    LAMP 7.0

  • Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, …) or VM (VMDK, VBOX):
    GCE

  • Have you installed any plugin or modified any configuration file?:
    NO

  • Describe here your question/suggestion/issue (expected and actual results):

LAMP 7.0 comes with PHP 7. My application has alot errors on it, How do i revert back to PHP 5.6?

  • Steps to reproduce the issue (if relevant):

  • Copy the apache log (if relevant):

PASTE HERE

Hello @ibenemevitalis

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.

Best Regards,

Juan Ariza


Was my answer helpful? Click on :heart:

how do i remove the previous LAMP Stack with PHP 7, i am web developer, with basic skill on server commands.

Is their any step by step process i am to follow with commands.

i have launched LAMP 7.

i have also successfully installed LAMP 5.6.

How do i remove the previous stack to make LAMP 5.6 the default?

Hello @ibenemevitalis

Once you’re connected via SSH to your server, you’ll notice that the default LAMP Stack with PHP 7 is installed at /opt/bitnami/. You need to follow these steps:

  • 1 - Stop all the services and remove the LAMP 7 Stack.
sudo /opt/bitnami/ctlscript.sh stop
sudo rm -rf /opt/bitnami/
  • 2 - Download the LAMP 5 Stack and install it following the steps indicated during the installation. We recommend to use /opt/bitnami/ as installation directory to have exactly the same configuration you’ll find in the docs.
wget https://downloads.bitnami.com/files/stacks/lampstack/5.6.31-0/bitnami-lampstack-5.6.31-0-linux-x64-installer.run
chmod +x bitnami-lampstack-5.6.31-0-linux-x64-installer.run
sudo ./bitnami-lampstack-5.6.31-0-linux-x64-installer.run

That’s all! You substituted your LAMP 7 with a LAMP 5.6.

Best Regards,

Juan Ariza


Was my answer helpful? Click on :heart:

2 Likes

after following the steps you provided.

i was able install LAMP . It came lots errors

    Installing

0% ______________ 50% ______________ 100%
########################################
Error: Unknown error while running /opt/bitnami/php/bin/php -q
/opt/bitnami/php/bin/fixreg.php /opt/bitnami/php/lib/php/.registry
@@BITROCK_PHP_ROOT@@ /opt/bitnami/php
Press [Enter] to continue:

Error: Unknown error while running /opt/bitnami/php/bin/php -q
/opt/bitnami/php/bin/fixreg.php
/opt/bitnami/php/lib/php/.registry/.channel.pear.amazonwebservices.com
@@BITROCK_PHP_ROOT@@ /opt/bitnami/php
Press [Enter] to continue:

Error: Unknown error while running /opt/bitnami/php/bin/php -q
/opt/bitnami/php/bin/fixreg.php /opt/bitnami/php/lib/php/.registry
@@BITROCK_APACHE_ROOTDIR@@ /opt/bitnami/apache2
Press [Enter] to continue:

Error: Unknown error while running /opt/bitnami/php/bin/php -q
/opt/bitnami/php/bin/fixreg.php /opt/bitnami/php/etc @@BITROCK_PHP_ROOT@@
/opt/bitnami/php
Press [Enter] to continue:
^[[AWarning: Problem running post-install step. Installation may not complete
correctly
Unknown error while running chown -R root:daemon
/opt/bitnami/frameworks/symfony/app
Press [Enter] to continue:
Warning: Problem running post-install step. Installation may not complete
correctly
Unknown error while running chown -R root:daemon
/opt/bitnami/frameworks/smarty/sample
Press [Enter] to continue:
Warning: Problem running post-install step. Installation may not complete
correctly
Unknown error while running chown -R root:daemon
/opt/bitnami/frameworks/laravel/storage
Press [Enter] to continue:

Error: Unknown error while running /opt/bitnami/ctlscript.sh start apache & >
/dev/null
Press [Enter] to continue:
Warning: Problem running post-install step. Installation may not complete
correctly
Unknown error while running chown -R root:daemon /opt/bitnami/apache2/htdocs
Press [Enter] to continue:


Setup has finished installing Bitnami LAMP Stack on your computer.
Launch Bitnami LAMP Stack [Y/n]: y
Error: There has been an error.
Unknown error while running /opt/bitnami/ctlscript.sh start
Press [Enter] to continue:

tried restarting my server. it got stuck on 99%

kindly check the errors above

Hello @ibenemevitalis

This is pretty weird. It seems that some substitutions didn’t work well in the installer. Did you remove the previous Stack as I mentioned before installing the new one?

Could you start from scratch and follow again the steps executing the commands below after removing the LAMP 7 Stack? Please share the output.

ls -la /opt/bitnami/
env

Best Regards,

Juan Ariza


Was my answer helpful? Click on :heart:

i did exactly as you instructed

ibenemevitalis@bitnami-lampstack-dm-21bf:~$ sudo /opt/bitnami/ctlscript.sh stop Syntax OK /opt/bitnami/apache2/scripts/ctl.sh : httpd stopped /opt/bitnami/php/scripts/ctl.sh : php-fpm stopped /opt/bitnami/mysql/scripts/ctl.sh : mysql stopped ibenemevitalis@bitnami-lampstack-dm-21bf:~$ sudo rm -rf /opt/bitnami/

before i proceeded to installing the new stack LAMP 5.6…

Do you advice i repeat the process once more?

Thank you, am really stuck here

ibenemevitalis@bitnami-lampstack-dm-21bf:~$ sudo /opt/bitnami/ctlscript.sh stop AH00526: Syntax error on line 46 of /opt/bitnami/apache2/conf/bitnami/bitnami.conf: SSLCertificateFile: file '/opt/bitnami/apache2/conf/server.crt' does not exist or is empty apache config test fails, aborting /opt/bitnami/mysql/scripts/ctl.sh : mysql not running ibenemevitalis@bitnami-lampstack-dm-21bf:~$ sudo rm -rf /opt/bitnami/ ibenemevitalis@bitnami-lampstack-dm-21bf:~$ ibenemevitalis@bitnami-lampstack-dm-21bf:~$ ls -la /opt/bitnami/ ls: cannot access /opt/bitnami/: No such file or directory ibenemevitalis@bitnami-lampstack-dm-21bf:~$ env TERM=xterm-256color SHELL=/bin/bash SSH_CLIENT=74.125.73.34 51112 22 SSH_TTY=/dev/pts/0 LC_ALL=en_US.UTF-8 USER=ibenemevitalis LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg =30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:* .lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=0 1;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=0 1;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31: *.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif =01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01; 35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35: *.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wm v=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35 :*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aa c=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00 ;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: SSH_AUTH_SOCK=/tmp/ssh-E6dLN8HXMn/agent.558 MAIL=/var/mail/ibenemevitalis PATH=/opt/bitnami/git/bin:/opt/bitnami/varnish/bin:/opt/bitnami/sqlite/bin:/opt/bitnami/php/bin:/opt/bitnami/mysq l/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games PWD=/home/ibenemevitalis LANG=en_US.UTF-8 SHLVL=1 HOME=/home/ibenemevitalis LANGUAGE=en_US.UTF-8 LOGNAME=ibenemevitalis

Hello @ibenemevitalis

I just tried the whole process and it worked as expected. See below:

bitnami@bitnami-lampstack-dm-e038:~$ sudo /opt/bitnami/ctlscript.sh stop
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped

bitnami@bitnami-lampstack-dm-e038:~$ sudo rm -rf /opt/bitnami/
bitnami@bitnami-lampstack-dm-e038:~$ wget https://downloads.bitnami.com/files/stacks/lampstack/5.6.31-0/bitnami-lampstack-5.6.31-0-linux-x64-installer.run
--2017-09-08 10:38:30--  https://downloads.bitnami.com/files/stacks/lampstack/5.6.31-0/bitnami-lampstack-5.6.31-0-linux-x64-installer.run
Resolving downloads.bitnami.com (downloads.bitnami.com)... 52.222.171.84, 52.222.171.6, 52.222.171.144, ...
Connecting to downloads.bitnami.com (downloads.bitnami.com)|52.222.171.84|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 97857302 (93M) [binary/octet-stream]
Saving to: ‘bitnami-lampstack-5.6.31-0-linux-x64-installer.run’
bitnami-lampstack-5.6.31-0-linux-x64-ins 100%[====================================================================================>]  93.32M  26.3MB/s   in 3.6s   

2017-09-08 10:38:34 (25.7 MB/s) - ‘bitnami-lampstack-5.6.31-0-linux-x64-installer.run’ saved [97857302/97857302]
bitnami@bitnami-lampstack-dm-e038:~$ chmod +x bitnami-lampstack-5.6.31-0-linux-x64-installer.run 
bitnami@bitnami-lampstack-dm-e038:~$ sudo ./bitnami-lampstack-5.6.31-0-linux-x64-installer.run 
----------------------------------------------------------------------------
Welcome to the Bitnami LAMP Stack Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want 
to install. Click Next when you are ready to continue.
Varnish [Y/n] :
Zend Framework [Y/n] :
Symfony [Y/n] :
CodeIgniter [Y/n] :
CakePHP [Y/n] :
Symfony [Y/n] :
CodeIgniter [Y/n] :
CakePHP [Y/n] :
Smarty [Y/n] :
Laravel [Y/n] :
PhpMyAdmin : Y (Cannot be edited)
Is the selection above correct? [Y/n]: 
----------------------------------------------------------------------------
Installation folder
Please, choose a folder to install Bitnami LAMP Stack
Select a folder [/opt/lampstack-5.6.31-0]: /opt/bitnami/
----------------------------------------------------------------------------
Create MySQL 'root' Account
Bitnami LAMP Stack database root user creation
Password :
Re-enter :
----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami LAMP Stack on your computer.
Do you want to continue? [Y/n]: 
----------------------------------------------------------------------------
Please wait while Setup installs Bitnami LAMP Stack on your computer.
 Installing
 0% ______________ 50% ______________ 100%
 #########################################
----------------------------------------------------------------------------
Setup has finished installing Bitnami LAMP Stack on your computer.
Launch Bitnami LAMP Stack [Y/n]:
 
bitnami@bitnami-lampstack-dm-e038:~$ which php
/opt/bitnami/php/bin/php

bitnami@bitnami-lampstack-dm-e038:~$ php -v
PHP 5.6.31 (cli) (built: Jul  8 2017 18:05:53) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Best Regards,

Juan Ariza

did you select all the components
Varnish [Y/n] : Zend Framework [Y/n] : Symfony [Y/n] : CodeIgniter [Y/n] : CakePHP [Y/n] : Symfony [Y/n] : CodeIgniter [Y/n] : CakePHP [Y/n] : Smarty [Y/n] : Laravel [Y/n] :

Cause i keyed in Yes to all of them, could that be the problem

Hello @ibenemevitalis

If you use ENTER/RETURN on every of them, the default option is YES (as you can see). In the example I shared, I selected all of them. Sorry if it’s not clear enough.

Best Regards,

Juan Ariza

Let me delete the entire VM and start again.

Why Cant Bitnami still keep the option of LAMP 5.6 in the marketplace, rather going through all this hassle.

currently, i can only automatically launch LAMP 7.0 by default, then manually removing and then reinstalling.

What do you reckon

Hello @ibenemevitalis

Despite maintaining more than one versions of some stacks (Legacy, Stable, Dev), every stack version is not published one every Cloud Marketplace. For example, you can found the image you’re looking on the AWS Marketplace (while it’s not published on other marketplaces):
https://aws.amazon.com/marketplace/pp/B007IN7GJA?qid=1504876001243&sr=0-3&ref_=srh_res_product_title

Thanks for your feedback. Your opinion will be shared with the product team.

Best Regards,

Juan Ariza

1 Like

works perfect, thanks lot

Hello @arvindwill

I am glad that the instructions helped you to install the LAMP 5.X.X on a LAMP 7 server. I proceed to close this ticket as solved. If you have any other questions, please do not hesitate to open a new thread.

Best Regards,

Juan Ariza