1

I'm trying to set php5.6.23 as fast CGI on my server for using php7 as main version

but in one of my domain, I get this error :

The requested URL / was not found on this server.

here is my vhost conf :

ScriptAlias / /usr/lib/cgi-bin
DocumentRoot "/home/ue4xxxx/www"

<Directory "/home/ue4xxxx/www">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all

        AddHandler php-cgi .php
        Action php-cgi /cgi-bin/php-cgi-5.6.23
        <FilesMatch "\.php*">
                SetHandler php-cgi
        </FilesMatch>
</Directory>

ErrorLog ${APACHE_LOG_DIR}/ue4/error.log
CustomLog ${APACHE_LOG_DIR}/ue4/access.log combined

I have the php cgi bin locate at /usr/lib/cgi-bin and I want to use the the file in the vhost root /home/ue4xxxx/www

UPDATE: After following some suggestions, the vhost conf is now:

<VirtualHost *:80>
    ServerAdmin postmaster@ue4-xxxx.tld
    ServerName ue4-xxxx.tld
    ServerAlias ue4-xxxx.tld

        ScriptAlias /cgi-bin /usr/lib/cgi-bin
        DocumentRoot "/home/ue4xxxx/www"

        <Directory "/home/ue4xxxx/www">
                Options Indexes FollowSymLinks Includes ExecCGI
                AllowOverride All
                Order allow,deny
                Allow from all

                AddHandler php-cgi .php
                Action php-cgi /cgi-bin/php-cgi-5.6.23
                <FilesMatch "\.php">
                    SetHandler php-cgi
                </FilesMatch>
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/ue4/error.log
    CustomLog ${APACHE_LOG_DIR}/ue4/access.log combined
</VirtualHost>

After these changes, I get a 404 error:

The requested URL /cgi-bin/php-cgi-5.6.23/index.php was not found on this server
  • Is the php-cgi-5.6.23 actually in /usr/lib/cgi-bin? – Colt Jun 30 '16 at 13:06
  • yes : -rwxr-xr-x 1 www-data www-data 25765695 Jun 30 13:30 php-cgi-5.6.23 – Jeremy Talus Jun 30 '16 at 13:11
  • 1
    are you just trying to run php5.6 on a system that has php7.x ? If by chance you are on a .deb distribution you might want to look at sury.org packages. You then have the option of using php-fpm to manage your php pools and you can install php5.6 php7.0 to php7.3 just with apt – Antony Gibbs Jan 5 at 14:41
0

You have an error here:

<FilesMatch "\.php*">

The "*" is not a wildcard in the sense that you used it, but means to "Repeat the previous match zero or more times."

You should review the Apache documentation for Regular Expressions, and change the FilesMatch to:

<FilesMatch "\.php">

ALSO: It looks like:

ScriptAlias / /usr/lib/cgi-bin

should probably be:

ScriptAlias /cgi-bin /usr/lib/cgi-bin

You can review the Apache documentation for the ScriptAlias Directive for more details of usage.

  • just tried but still not working – Jeremy Talus Jun 30 '16 at 12:07
  • If you have chosen to fix this part of the problem, you should post an UPDATE with the change to your answer to help others keep track of current status of issue. NOTE: DO NOT just change what you already posted, as this will quickly lead to confusion and lost continuity for people trying to understand where you started, what you have since done, etc. If you have not made the change, you might make that clear in a comment here so others clearly know where you are and can agree or disagree. – Colt Jun 30 '16 at 12:23
  • I change the ScriptAlias from / to /cgi-bin now I get this 404 : The requested URL /cgi-bin/php-cgi-5.6.23/index.php was not found on this server. I want to use the file on the root web /home/ue4xxxx/www – Jeremy Talus Jun 30 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.