Chandni Handa
Chandni Handa

Reputation: 53

How to run multiple PHP version with XAMPP?

I have multiple projects based on PHP. Some require PHP version 5.x to run and other strictly require PHP 7.0 or above. I am working on these simultaneously. Is there a way to run multiple PHP versions such that I can switch between them when working on different projects.

Upvotes: 3

Views: 5280

Answers (2)

Kaushal Sachan
Kaushal Sachan

Reputation: 1243

>> Open C:\xampp\apache\conf\extra\httpd-xampp.conf
>> Write Following code at Bottom of this (httpd-xampp.conf) file

    ScriptAlias /php56 "C:/xampp/php56"
    <Directory "C:/xampp/php56">
        AllowOverride None
        Options None
        Require all denied
        <Files "php-cgi.exe">
            Require all granted
        </Files>
    </Directory>

>> Open C:\xampp\apache\conf\extra\httpd-vhosts.conf\httpd-vhosts.conf
>> Create a virchual host in Different post By Writing Following code

    <VirtualHost *:8081>
        UnsetEnv PHPRC
        <FilesMatch "\.php$">
            php_flag engine off
            SetHandler application/x-httpd-php5_6
            Action application/x-httpd-php5_6 "/php5_6/php-cgi.exe"
        </FilesMatch>
        DocumentRoot "C:/xampp/htdocs/myphp5_6_project"
    </VirtualHost>

>> Create a folder "myphp5_6_project" in htdocs of xampp
>> Open C:\xampp\apache\conf\httpd.conf
>> Write Listen 8081 (any where or Below Listen 80 line)
>> Restart Apache Services

Upvotes: 0

Prashant Jaiswal
Prashant Jaiswal

Reputation: 76

Try these steps:

  1. Stop LAMP if running.

Download libphp7.so if you don't have

https://github.com/prashant-techindustan/php7module_library/blob/master/libphp7.so

  1. Edit /opt/lampp/etc/extra/httpd-xampp.conf (Comment out one of the following which is not needed):

    LoadModule php5_module modules/libphp5.so

    LoadModule php7_module modules/libphp7.so

  2. Start LAMP

Upvotes: 6

Related Questions