Matt Mrowicki
asked on
Why is Apache2 web server on Debian Linux displaying script source code?
I tried to install the phpMyAdmin package on a Debian Linux 6 server (via apt-get). When the package installed, it removed Apache and installed Apache2. Now, when I try to browse to .cgi and .sql pages on the web server (the files are located in /home/www/), the source code is displayed instead of being executed. What do I need to configure so that the code is executed instead of being displayed in the browser?
Other Information:
html files seem to work fine.
Other Information:
html files seem to work fine.
Make sure PHP is installed. '.cgi' is usually Perl and '.sql' is usually SQL code that doesn't make any sense as a web page.
ASKER
When I do a perl -v, I get a response that perl, v5.10.1 is installed.
This server has a bunch of .sql files. They start with code like:
<! SQL connect localhost <database> <password> >
This server has a bunch of .sql files. They start with code like:
<! SQL connect localhost <database> <password> >
ASKER
When I do php --version, I get PHP 5.3.3-7+squeeze19...
ASKER
php is also working ok. I get the expected results from phpinfo( ).
But do you see phpinfo() in you web browser when you try to access it thru Apache? Is phpMyAdmin working?
I don't know what those SQL files are for. Nothing on my systems would run those.
I don't know what those SQL files are for. Nothing on my systems would run those.
ASKER
Yes, phpinfo() works fine in the browser.
It looks the .sql files are MySQL code. In the original Apache setup, I found the following in httpd.conf.
# Add the handler for www-mysql
AddHandler www-sql .sql
Action www-sql /cgi-bin/www-mysql
I think if I could get this to work with Apache2, I'd be set.
It looks the .sql files are MySQL code. In the original Apache setup, I found the following in httpd.conf.
# Add the handler for www-mysql
AddHandler www-sql .sql
Action www-sql /cgi-bin/www-mysql
I think if I could get this to work with Apache2, I'd be set.
do you browse to localhost/... or rather /apache_root/htdocs etc. ??
is your apache started at all?
please post a screenshot
is your apache started at all?
please post a screenshot
ASKER
I'm actually browsing from another PC on the network via IP address.
If I browse to:
http://10.10.100.252/admin/sessions.sql
I get a 404 page:
Not Found
The requested URL /cgi-bin/www-mysql/admin/s essions.sq l was not found on this server.
Apache/2.2.16 (Debian) Server at 10.10.100.252 Port 80
If I browse to:
http://10.10.100.252/admin/sessions.sql
I get a 404 page:
Not Found
The requested URL /cgi-bin/www-mysql/admin/s
Apache/2.2.16 (Debian) Server at 10.10.100.252 Port 80
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is cgi-bin a ScriptAlias?
Is script www-mysql exiting without import errors when ran from command line?
Is script www-mysql exiting without import errors when ran from command line?
Are you saying that both .cgi and .sql files are displaying the source code rather than being executed? Or are .cgi files executing correctly but not .sql files?
What is the actual path to sessions.sql?
Did you restart apache after adding:
What is the actual path to sessions.sql?
Did you restart apache after adding:
# Add the handler for www-mysql
AddHandler www-sql .sql
Action www-sql /cgi-bin/www-mysql
restart apache is
# apachectl graceful
# apachectl graceful
ASKER
The issue has been resolved. The problem was the configuration in httpd.conf. What made it tricky is that when the initial Apache installation was done (before the update to Apache2), some defaults were not the same as used in Apache2. Once the file was edited with the correct info, everything worked properly. Thank you for all of the assistance!