3

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.

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

Comments

0
>> 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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.