Is there a way to force freepbx (amportal) to use specified php version?

I have both php 7.0 and 5.6 installed on Debian 9.3. Apache 2.4.25 virtual hosts are directed to specified php versions with php-fpm/fastcgi. I have verified that the freepbx 14 host IS going to php 5.6 (via fpm) and that it connects to mariadb 10 and asterisk 13, but I am still receiving the php 7 compatibly errors (whoops…) when I run amportal. Is there a way to force freepbx (amportal) to use specified php version? Perhaps hard code it?

Make sure the references in the /etc/php.ini file are all correct for the version you want to use (to start). If you include anything (via the various path statements) that’s php7 in your php.ini for 5.6, you can cause this problem.

If you have both installed, I’m going to guess that the php executable is differentiated by a version number on the executable and that you are executing through a symlink? If so, you should be able to point your fwconsole (I’m pretty sure you shouldn’t be using amportal any more) installation at the specific php executable (/usr/local/bin/php67, for example). The trick there is that I don’t remember if you can modify the magic cookie line of the fwconsole program (is it a script or a real executable?) to point to a specific instance of the code.

It is still possible that you won’t be able to cleanly have both executables running on the system at the same time, but one (or maybe both) of these should get you started down the right road.

Thanks for response. I do have two php executables and a “php” symlink that points to php7.0 in /usr/bin. If I create a custom symlink that points to the php5.6 executable, I am still not sure how to point fwconsole to it. I do not recall the installation asking where php is. That is why I assumed, maybe, that you could hard code it and point it to php5.6 symlink. While the apache host is definitely being directed to php5.6 via fpm seems like fwconsole is trying to execute the default php. Does that make sense? Any ideas?

If fwconsole is a script, the “magic cookie” line is the first line of the script (I don’t have access to a phone server from here). If should look like “#!/usr/bin/php other stuff”. It the program is NOT a script, you will need to use “ln -f /wherever/56_is /usr/bin” and change the symlink for php (which will likely screw up the rest of your system.

Never intended to change the default php7 installation. So, I created a new symlink php5 that points to the php5.6 executable and changed #!/usr/bin/env php to #!/usr/bin/env php5 in fwconsole (and other files in /var/lib/asterisk/bin/). Fwconsole is now working. Working on some other issues. Hopefully thats it. Thanks.

1 Like

This will break other things now. Firstly when fwconsole gets upgraded it will reset. Dialparties.agi won’t work and neither will any other agi on the system.

So… There is no way to run freepbx using php5.6 when php7.0 is installed?

No. We should focus on fixing the php 7 issues.

If you find PHP 7 bugs please report them at http://issues.freepbx.org so they are on our radar.