Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning PHP file outside of documentroot (cgi-bin folder)
    text
    copied!<p>I am working with a colleague to set up their local environment on a MAC in XAMPP, on windows my vhost looks like the one below.</p> <p>When I access a URL like <a href="http://domain.local/cgi-bin/handler.php" rel="nofollow">http://domain.local/cgi-bin/handler.php</a> the web server processes the PHP correctly but on his we get a 500 server error and this message...</p> <pre><code>The server encountered an internal error and was unable to complete your request. Error message: Premature end of script headers: </code></pre> <p>We tried changing the name of the cgi-bin folder to something else as I noticed there was another alias in httpd.conf but this had no effect...so it seems to me like the issue is permissions related.</p> <p>We believe the alias is setup ok as accessing <a href="http://domain.local/cgi-bin/filenothere.php" rel="nofollow">http://domain.local/cgi-bin/filenothere.php</a> which doesn't exist throws a 404 as expected, any .html/.pl files fail to execute.</p> <p>The permissions that exist on the cgi-bin folder are...</p> <p>rwxrwxrwx dave staff</p> <p>and is owned by the user and group....</p> <p>dave staff</p> <p>Vhost</p> <pre><code>&lt;VirtualHost *:80&gt; ServerAdmin webmaster@example.com ServerName www.domain.local ServerAlias domain.local ServerAlias api.domain.local # Indexes + Directory Root. DirectoryIndex index.php DocumentRoot E:/home/www/www.domain.co.uk/htdocs/ # CGI Directory ScriptAlias /cgi-bin/ E:/home/www/www.domain.co.uk/cgi-bin/ &lt;Location /cgi-bin&gt; Options +ExecCGI &lt;/Location&gt; # Logfiles ErrorLog E:/home/www/www.domain.co.uk/logs/error.log CustomLog E:/home/www/www.domain.co.uk/logs/access.log combined &lt;/VirtualHost&gt; </code></pre> <p>Any idea what is causing this PHP file to not be executed?</p> <p><strong>UPDATE</strong> Tried adding a header to say that the content is PHP to the start of the PHP file and this now simply outputs the PHP code.</p> <p>It's as if any path specified in as an Alias is accessible but the server doesn't know how to execute the content, this is for HTML as well as PHP</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload