3

I have 2 different virtual hosts on my apache server. One of them needs php7.x and another need php5.x.

Is it possible to use project-specific PHP versions?

I have tried the following,

Running two PHP versions on the same server

but my apache server crashed saying there's some syntactical error in one of the fpm's config file.

Also I cant follow this solution since It advices to uninstall apache and start over again and I can't do that on a live server.

Is there any way to do this without uninstalling the apache server. Thank you for your suggestions.

shellbot97
  • 198
  • 1
  • 12
  • What are your specs? If you need to run it as Apache module, then you need two copies of Apache running on different IP/port combinations. If PHP-FPM is fine, I think you should fix the syntax error rather than drop the solution entirely. – Álvaro González Aug 04 '19 at 14:24
  • Its giving me `Syntax error on line 27 of /etc/apache2/conf-enabled/php5.6-fpm.conf` which states, `Alias /php56-fcgi /usr/lib/cgi-bin/php56-fcgi -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization` – shellbot97 Aug 05 '19 at 10:12

1 Answers1

1

for windows on file httpd-vhosta.conf

<VirtualHost *:80>
    DocumentRoot "d:/server/htdocs/"
    ServerName localhost
    ServerAlias www.localhost

    <Directory "d:/server/htdocs/">
        Require all granted
        <Files ~ "\.php$">
            AddHandler fcgid-script .php
            #FcgidWrapper "d:/server/php/php-5.6.40-Win32-VC11-x64/php-cgi.exe" .php
            FcgidWrapper "d:/server/php/php-7.1.24-Win32-VC14-x64/php-cgi.exe" .php
            Options +ExecCGI
        </Files>
    </Directory>
    ErrorLog "D:/server/apache/logs/error-localhost.log"
    SetEnv APP_ON_LOCAL 1

</VirtualHost>
javad shariaty
  • 939
  • 10
  • 14