Selectable versions of php

I have a new Mythic vm running Sympl 12. I have attempted to configure PHP5.6 for example.co.uk without success.

Output from phpinfo.php unexpectedly shows PHP version: 8.2.25 rather than 5.6

Outputs are as follows:

Domain: example.co.uk
Configuring site for PHP 5.6
Installing php5.6 …
Installing php5.6-cli …
Installing php5.6-fpm …
Installing php5.6-common …
Installing new package: php5.6-bz2
Installing new package: php5.6-curl
Installing new package: php5.6-gd
Installing new package: php5.6-imagick
E: Sub-process /usr/bin/dpkg returned an error code (1)
Installing new package: php5.6-intl
Installing new package: php5.6-mbstring
Installing new package: php5.6-mcrypt
Installing new package: php5.6-mysql
Installing new package: php5.6-xml
Installing new package: php5.6-xmlrpc
Installing new package: php5.6-zip
Configured with ‘default’ pool
Created pool link for domain
PHP-FPM enabled on example.co.uk
Pool configuration changed, will reload PHP 5.6

Applying configuration… done

//////

sympl@hillcrest:~$ sudo sympl-php-configure
[sudo] password for sympl:

Domain: example.co.uk
Configuring site for PHP 5.6
Configured with ‘default’ pool

Applying configuration… done

sympl@hillcrest:~$

//////

sympl@hillcrest:~$ sudo sympl-web-configure --verbose example.co.uk
Domain: example.co.uk
SSL is not enabled – using non-SSL template
Adding to configurations
Configuration: example.co.uk.conf
Configuration is up-to date.
Already enabled.
sympl@hillcrest:~$

//////

sympl@hillcrest:~$ sudo apachectl -t
Syntax OK
sympl@hillcrest:~$

/////

sympl@hillcrest:~$ sudo service apache2 status
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-11-14 20:45:00 UTC; 1h 13min ago
Docs: Apache HTTP Server Version 2.4 Documentation - Apache HTTP Server Version 2.4
Process: 768644 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Tasks: 20 (limit: 1141)
Memory: 41.3M
CPU: 936ms
CGroup: /system.slice/apache2.service
├─768661 /usr/sbin/apache2 -k start
├─768662 /usr/sbin/sympl-web-logger -l ssl_access.log /var/log/apache2/zz-mass-hosting.ssl_access.log
├─768663 /usr/sbin/sympl-web-logger -l access.log /var/log/apache2/zz-mass-hosting.access.log
├─768674 /usr/sbin/apache2 -k start
├─768675 /usr/sbin/apache2 -k start
├─768676 /usr/sbin/apache2 -k start
├─768677 /usr/sbin/apache2 -k start
├─768678 /usr/sbin/apache2 -k start
├─768683 /usr/sbin/apache2 -k start
└─768719 /usr/sbin/apache2 -k start

Nov 14 20:45:00 hillcrest.vs.mythic-beasts.com systemd[1]: Starting apache2.service - The Apache HTTP Server…
Nov 14 20:45:00 hillcrest.vs.mythic-beasts.com systemd[1]: Started apache2.service - The Apache HTTP Server.
sympl@hillcrest:~$

/////

So surely phpinfo.php should display PHP5.6 at this stage?

Check the generated Apache .conf file in /etc/apache2/conf-enabled.

It should contain a line starting:

SetHandler "proxy:unix:/etc/sympl/php/domain/...

Tvm for the response. Is the suggested file path above correct? There’s just a bunch of symlinks in that directory. However, I can see the following line in /etc/apache2/sites-enabled/exampledomain.co.uk.conf

  # Pass PHP files to relevant PHP-FPM socket via symlink
  SetHandler "proxy:unix:/etc/sympl/php/domain/exampledomain.co.uk|fcgi://127.0.0.1"

Yes, that’s correct, and what you should expect to see.

I’ve replicated your setup with a simple phpinfo() file in the webroot, and a single config/php configuration file for a new domain, and it’s working as expected.

If the domain you’re using has HSTS enabled (which I suspect it has as I think you’re migrating an existing site), then your browser/client will:

  1. Force ‘upgrade’ the connection to HTTPS, so not connect to the HTTP site you have configured.
  2. Connect to the ‘fallback’ site instead, which provides HTTPS, although with the default server certificate.
  3. Serve the traffic using the fallback (AKA zz-mass-hosting) Apache configuration, which only provides the server-default PHP version.

You can test this on regular HTTP with something like:

curl --silent --hsts /dev/null --resolve exampledomain.co.uk:80:$(sympl-ip) http://exampledomain.co.uk/php-info.php

Alternatively, as you’re migrating from elsewhere, you can copy the SSL certificates from the old server and run sudo sympl-web-configure - Sympl will configure itself using the existing SSL certificates, which then allow your client to access the site via the HTTPS URL.

Thank you so much for the pointers above. Allow me to do a little more testing and I’ll revert…