Author Topic: Support for multiple versions of php  (Read 259 times)

whiterabbitz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Support for multiple versions of php
« on: February 28, 2022, 07:01:29 pm »
Hi,

and thanks for the great product been using it for a while now.

I have come up against the need to host a legacy site that only runs php 5.5, while the other sites run well on the latest..

Is it possible fior ehcp forced to  support multiple versions of php for sites?

Thanks in advance

whiterabbitz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Support for multiple versions of php
« Reply #1 on: March 01, 2022, 10:44:50 pm »
Hi Again,

Update

Currently testing but appears to work.
Ubantu 20.4

Loaded php5.5-fpm  and started service

Edited the Apache2 template for the domain as follows

#   ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1
#   ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={homedir}:/usr/share/php:/usr/share/pear; \n upload_tmp_dir={homedir}/phptmpdir; \n session.save_path={homedir}/phptmpdir;"
<FilesMatch \.php$>
        # From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server
         SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost"
    </FilesMatch>

Still yet to test lets encrypt and mysql acess etc .. but phpinfo() in the index file on this site shows 5.6, and another generic domain with the original template shows 7.4.




whiterabbitz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Support for multiple versions of php
« Reply #2 on: March 03, 2022, 05:38:55 pm »
On testing

Uncommenting the ProxyFCGISetEnvIf line put back all the environmental goodies like upload directory and session directory

earnolmartin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 272
    • View Profile
Re: Support for multiple versions of php
« Reply #3 on: March 31, 2022, 09:51:31 am »
Yes, EHCP should work with any PHP version.  It still works on Ubuntu 14.04 and up.  Thanks for posting your results and tests. 

And yes, it should be possible to run multiple versions of PHP simultaneously by changing the php-fpm port for each separate PHP instance.  Then, you would just modify the domain template's php sections to use the correct fpm port for the domain that requires a specific version (matching the fpm port for the specific version you need), and it should be that simple.

 ;D
« Last Edit: March 31, 2022, 09:56:16 am by earnolmartin »