Italian Trulli

PHP 5.6, released in 2014, is now considered outdated, and many operating systems no longer support it due to security concerns and the availability of newer PHP versions. Here’s the status of PHP 5.6 support across several major Linux distributions:

 

1. Debian
  • Unsupported: Starting from Debian 10 “Buster,” PHP 5.6 is no longer included in the official repositories. Debian 9 “Stretch” was the last version to include PHP 5.6.
  • Current Versions: Debian 11 “Bullseye” and Debian 12 “Bookworm” do not support PHP 5.6.
2. Ubuntu
  • Unsupported: Starting with Ubuntu 18.04 LTS “Bionic Beaver,” PHP 5.6 was removed from the official repositories. PHP 7.x is the default version from Ubuntu 16.04 LTS onwards.
  • Current Versions: Ubuntu 20.04 LTS and Ubuntu 22.04 LTS do not support PHP 5.6.
3. AlmaLinux
  • Unsupported: AlmaLinux, which is a CentOS 8 replacement, does not support PHP 5.6. It is based on the Red Hat Enterprise Linux (RHEL) 8 codebase, which does not include PHP 5.6 in its repositories.
  • Current Versions: AlmaLinux 8 and 9 are focused on supporting more recent versions of PHP.

If you’re running any of the latest versions of these operating systems—Debian 10 and later, Ubuntu 18.04 LTS and later, CentOS 8, or AlmaLinux 8 and 9—you will no longer find official support for PHP 5.6. Upgrading to a newer PHP version, such as PHP 7.4 or PHP 8.x, is highly recommended for better performance, security, and compatibility with modern web applications.

This solution requires a working Cyberpanel installation

If you need to run a Laravel/WordPress or even a basic website running on php56
Let’s use domain oldapplication.com as the domain you are going to set up the old application for.
A website should be created for oldapplication.com and a database as required in Cyberpanel.

  1. Navigate to https://myserver.com:8090/docker/manageImages
  2. Search for “sajetek/php56-70-71-72-73-ols-ssl-centos7” or “sajetek/php5.6-ols-ssl” or “sajetek/php5.6-apache2.4-ssl” If you prefer Apache backend. (this is not too important as we are only using it for serving)Read the overview of both here to know which modules are enabled by default:If you are using sajetek/php56-70-71-72-73-ols-ssl-centos7: then as root user execute this mysql query:
    ALTER TABLE cyberpanel.dockerManager_containers CHANGE image image VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
  3. Select Tag: latest and click “Pull”
  4. Once it’s pulled, click “CREATE CONTAINER”
  5. Select Tag: latest and click “Create”
  6. Select your owner, set Memory limit and set ports to whatever you desire. I usually use 8443 for 443, 8000 for 80, 8708 for 7080
  7. DEFAULT_PHP can be set to an appropriate value (see docker overview for each image) but for this tutorial, leave it as 56
  8. DOCUMENT_ROOT for WordPress or basic sites you can leave this as “/” but for Laravel applications, you want to set this to “/public” so that the public folder is your root directory.If you used sajetek/php5.6-apache2.4-ssl, then set DOCUMENT_ROOT to “/var/www/html” or for Laravel applications, you want to set this to “/var/www/html/public” so that the public folder is your root directory
  9. Click “Add field”. For Destination, set “/usr/local/lsws/Example/html” and Source should be set to your document root which is usually “/home/oldapplication.com/public_html”
  10. Check “Start on reboot” if required and then click “Save
  11. Navigate to https://myserver.com:8090/websites/oldapplication.com and click on “vHost Conf
  12. In your rewrite section add the following line “REWRITERULE ^(.*)$ https://dockeroldapplication443/$1 [P]” to make it look similar to the following:
    rewrite {
        enable 1
        autoLoadHtaccess 1
        #ENFORCE REDIRECT TO HTTPS
        REWRITERULE ^/(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
        REWRITERULE ^(.*)$ https://dockeroldapplication443/$1 [P]
    }
  13. Via SSH or SFTP whichever you have (See image for setting from WebAdmin Console), edit /usr/local/lsws/conf/httpd_config.conf and add the following to the bottom of the file (modify as required):
    extprocessor dockeroldapplication443 {
        type proxy
        address https://127.0.0.1:8443
        maxConns 100
        pcKeepAliveTimeout 60
        initTimeout 60
        retryTimeout 0
        respBuffer 0
    }
  14. Restart openlitespeed
    If you do NOT need Database Access then you are completed.

    IF you DO need Database access, then continue the tutorial.
  15. Navigate to https://myserver.com:8090/dataBases/listDBs and select your domain. Click Manage for the database for your application and set the IP address to “172.17.0.2” and click “Save Changes”
    IP 172.17.0.2 will be the IP of your first docker container. To accurately get the IP use:
    docker inspect {insert_container_id} | jq ‘.[0].NetworkSettings.Networks.bridge.IPAddress’
  16. Edit the database credentials for your application and set the host to your server’s IP address
  17. Allow “172.17.0.2” access to port 3306 through your server’s firewall. For csf, you can add the following to the allow list “tcp|in|d=3306|s=172.17.0.2”

Conclusion:

This allows you to run your application/website on a proxy to my docker image which runs on CentOS 7 and php5.6.
Your website files and databases remain on your host server which can be managed via backups as needed.

If this was helpful

If this was helpful then

Leave a Comment

© 2024 SaJeTek Engineering. All rights reserved.

women
people
man
leaf graphics
leaf graphics