{"id":2665,"date":"2025-06-08T20:11:42","date_gmt":"2025-12-19T16:15:58","guid":{"rendered":""},"modified":"2025-02-02T00:46:19","modified_gmt":"2025-02-01T23:46:19","slug":"how-to-install-php-5-6-and-7-0-8-3-with-php-fpm-and-fastcgi-mode-for-ispconfig-3-2-on-ubuntu-20-04-24-04","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-php-5-6-and-7-0-8-3-with-php-fpm-and-fastcgi-mode-for-ispconfig-3-2-on-ubuntu-20-04-24-04\/","title":{"rendered":"How to Install PHP 5.6 and 7.0 &#8211; 8.3 with PHP-FPM and FastCGI Mode for ISPConfig 3.2 on Ubuntu 20.04 &#8211; 24.04"},"content":{"rendered":"<header>\n<h1>\u00a0<\/h1>\n<\/header>\n<section>\n<p>Running multiple PHP versions on your server allows you to support legacy applications while keeping up with the latest features and security patches. In this guide, we&#8217;ll show you how to install PHP versions 5.6, 7.0 through 8.3 with PHP-FPM and FastCGI mode for ISPConfig 3.2 on Ubuntu 20.04 &#8211; 24.04. This setup is perfect for web hosting environments, especially on <strong>VPS servers<\/strong>.<\/p>\n<h2>Step 1: Add the Ondrej PHP Repository<\/h2>\n<p>Ubuntu\u2019s default repositories do not provide older versions of PHP, so you&#8217;ll need to add the Ondrej PHP repository, which offers multiple versions of PHP. Run the following commands to add this repository to your system:<\/p>\n<pre><code>sudo apt update\r\nsudo apt install software-properties-common\r\nsudo add-apt-repository ppa:ondrej\/php<\/code><\/pre>\n<p>After adding the repository, update the package list:<\/p>\n<pre><code>sudo apt update<\/code><\/pre>\n<h2>Step 2: Install PHP Versions 5.6, 7.0 &#8211; 8.3<\/h2>\n<p>Now that the Ondrej PHP repository is enabled, you can install the desired PHP versions. Use the following commands to install each PHP version along with the necessary PHP-FPM and FastCGI modules:<\/p>\n<h3>Install PHP 5.6<\/h3>\n<pre><code>sudo apt install php5.6 php5.6-fpm php5.6-cgi<\/code><\/pre>\n<h3>Install PHP 7.0 &#8211; 7.4<\/h3>\n<pre><code>\r\nsudo apt install php7.0 php7.0-fpm php7.0-cgi\r\nsudo apt install php7.1 php7.1-fpm php7.1-cgi\r\nsudo apt install php7.2 php7.2-fpm php7.2-cgi\r\nsudo apt install php7.3 php7.3-fpm php7.3-cgi\r\nsudo apt install php7.4 php7.4-fpm php7.4-cgi\r\n        <\/code><\/pre>\n<h3>Install PHP 8.0 &#8211; 8.3<\/h3>\n<pre><code>\r\nsudo apt install php8.0 php8.0-fpm php8.0-cgi\r\nsudo apt install php8.1 php8.1-fpm php8.1-cgi\r\nsudo apt install php8.2 php8.2-fpm php8.2-cgi\r\nsudo apt install php8.3 php8.3-fpm php8.3-cgi\r\n        <\/code><\/pre>\n<p>This will install multiple PHP versions, their FastCGI binaries, and the PHP-FPM services required to manage each version.<\/p>\n<h2>Step 3: Configure PHP-FPM Pools for Each Version<\/h2>\n<p>Each PHP version installed using PHP-FPM needs its own configuration file (known as a pool). You\u2019ll configure separate pools for each PHP version to handle different websites and applications.<\/p>\n<p>Navigate to the PHP-FPM configuration directory and edit the pool configuration files:<\/p>\n<pre><code>sudo nano \/etc\/php\/5.6\/fpm\/pool.d\/www.conf<\/code><\/pre>\n<p>Modify the <code>listen<\/code> directive to specify a unique socket for PHP 5.6:<\/p>\n<pre><code>listen = \/run\/php\/php5.6-fpm.sock<\/code><\/pre>\n<p>Repeat this process for all other installed PHP versions (7.0 &#8211; 8.3) to ensure each version has its own pool file and unique socket. For example, for PHP 7.4, the listen directive would be:<\/p>\n<pre><code>listen = \/run\/php\/php7.4-fpm.sock<\/code><\/pre>\n<p>Once all pool configurations are set, restart the PHP-FPM services:<\/p>\n<pre><code>\r\nsudo systemctl restart php5.6-fpm\r\nsudo systemctl restart php7.0-fpm\r\nsudo systemctl restart php7.1-fpm\r\nsudo systemctl restart php7.2-fpm\r\nsudo systemctl restart php7.3-fpm\r\nsudo systemctl restart php7.4-fpm\r\nsudo systemctl restart php8.0-fpm\r\nsudo systemctl restart php8.1-fpm\r\nsudo systemctl restart php8.2-fpm\r\nsudo systemctl restart php8.3-fpm\r\n        <\/code><\/pre>\n<h2>Step 4: Integrate PHP Versions with ISPConfig 3.2<\/h2>\n<p>Now that multiple PHP versions are installed and configured, you can integrate them with ISPConfig 3.2 to allow websites to use different PHP versions. Follow these steps:<\/p>\n<ol>\n<li>Log into your ISPConfig control panel.<\/li>\n<li>Go to <strong>System<\/strong> &gt; <strong>Server Config<\/strong> and click on the <strong>Web<\/strong> tab.<\/li>\n<li>Scroll down to <strong>PHP Settings<\/strong> and add the paths to each PHP-FPM binary.<\/li>\n<\/ol>\n<p>For example, for PHP 7.4, add:<\/p>\n<pre><code>\/usr\/bin\/php7.4-cgi<\/code><\/pre>\n<p>Repeat this for all PHP versions you want to support, then save the settings. ISPConfig will now allow you to choose different PHP versions for each site hosted on your <strong>VPS server<\/strong>.<\/p>\n<h2>Step 5: Configure FastCGI for Nginx or Apache<\/h2>\n<p>Depending on whether you use Nginx or Apache as your web server, you\u2019ll need to configure FastCGI to handle PHP requests.<\/p>\n<h3>Nginx Configuration<\/h3>\n<p>For Nginx, open your site&#8217;s configuration file and ensure the FastCGI block points to the correct PHP-FPM socket. For example, to use PHP 7.4, add the following:<\/p>\n<pre><code>\r\nlocation ~ \\.php$ {\r\n    include snippets\/fastcgi-php.conf;\r\n    fastcgi_pass unix:\/run\/php\/php7.4-fpm.sock;\r\n}\r\n        <\/code><\/pre>\n<h3>Apache Configuration<\/h3>\n<p>If you are using Apache, edit the site&#8217;s virtual host file to specify the PHP version for FastCGI. For example, to use PHP 7.4, add:<\/p>\n<pre><code>\r\n\r\n    SetHandler \"proxy:unix:\/run\/php\/php7.4-fpm.sock|fcgi:\/\/localhost\"\r\n\r\n        <\/code><\/pre>\n<p>After configuring FastCGI for the appropriate web server, restart Nginx or Apache to apply the changes:<\/p>\n<pre><code>sudo systemctl restart nginx<\/code><\/pre>\n<pre><code>sudo systemctl restart apache2<\/code><\/pre>\n<h2>Step 6: Testing and Managing PHP Versions<\/h2>\n<p>Once the configurations are complete, you can test that each website on your <strong>VPS server<\/strong> is running the correct PHP version by creating a <code>phpinfo()<\/code> file in the website\u2019s root directory:<\/p>\n<pre><code>\r\n<!--?php \r\nphpinfo();\r\n?-->\r\n        <\/code><\/pre>\n<p>Access the file in your browser, and it will display the PHP version in use. You can now run multiple PHP versions on a single server.<\/p>\n<h2>Running Multiple PHP Versions on a VPS<\/h2>\n<p>Using a <strong>VPS server<\/strong> for hosting multiple PHP versions allows you to efficiently manage legacy applications while also supporting newer PHP versions for modern web applications. With ISPConfig 3.2 and FastCGI mode, you can easily switch between PHP versions per website, providing flexibility for developers and site owners.<\/p>\n<h2>Looking for a Reliable VPS Solution?<\/h2>\n<p>If you&#8217;re looking for a scalable and reliable <strong>VPS server<\/strong> to host multiple PHP versions and web applications, consider using . With <strong>Windows VPS<\/strong>, you get high-performance VPS hosting with full control over your server, perfect for hosting multiple PHP environments.<\/p>\n<footer>\n<p>For more VPS server solutions and guides, visit <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">netcloud24.com<\/a>.<\/p>\n<\/footer>\n<\/section>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 Running multiple PHP versions on your server allows you to support legacy applications while keeping up with the latest features and security patches. In this guide, we&#8217;ll\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2665","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2665"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2665\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}