Running php scripts outside of document root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am new to apache and php, so I suspect this will be an easy one to answer.

In short, I am trying to set up my document root to be /var/www/htdocs
and I want my php scripts to run in /var/www/cgi-bin. For some reason
I am getting "500 internal server error" when I try to run a script
(called phpauth.php) in that directory. If I try to run the same
script in the document root, it works fine but I don't want to do
that.

Here are the relevant lines of the error log:

[Sat May 23 22:19:02 2009] [error] [client {mylaptop.ip.address}]
(8)Exec format error: exec of '/var/www/cgi-bin/phpauth.php' failed,
referer: http://{myserver.ip.address}
[Sat May 23 22:19:02 2009] [error] [client {mylaptop.ip.address}]
Premature end of script headers: phpauth.php, referer:
http://{myserver.ip.address}

I am running apache 2.2 on Debian, with the config settings at default
except as shown below.

This is a listing of /etc/apache2/sites-enabled/000-default, which is
a symlink to /etc/apache2/sites-available/default. The only changes
are where I commented out lines and replaced them with the lines
immediately below them.

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	
#	DocumentRoot /var/www
	DocumentRoot /var/www/htdocs
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
#	<Directory /var/www>
	<Directory /var/www/htdocs>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
#	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	ScriptAlias /cgi-bin/ /var/www/cgi-bin/
#	<Directory "/usr/lib/cgi-bin">
	<Directory "/var/www/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>
	ErrorLog /var/log/apache2/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /var/log/apache2/access.log combined
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

I didn't make any changes in apache2.conf or anywhere else. I just
changed /etc/apache2/sites-available/default as shown above, then I
did apache2ctl stop, a2dissite default, a2ensite default, apache2ctl
start.

Thanks
-Lyle

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux