Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Apache configuration.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,
I compiled PHP 4.0 as CGI binary and I have got it in /usr/local/bin. Then I configured my Apache server and added lines to httpd.conf:
ScriptAlias /php/ "/usr/local/bin/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php /php/php
... and I can open PHP file, but only if it is localized in Apache's DocumentRoot (/var/apache/htdocs). My Apache's ServerRoot is /var/apache. I would like to create directory /var/apache/php to keep PHP files there and open PHP files using URL: I tried very hard to configure Apache to make it behaviours in this way, but it still do not. What should I change in httpd.conf?

Thanks,
Wojtek.
 
You could try this, but I am not sure it works
Alias /php/ "/var/apache/php"
AddType application/x-httpd-php .php
Action application/x-httpd-php /usr/local/bin/php //Daniel
 
Hi,

If you did the ./configure with (at least) the option '--with-apxs=/usr/local/apache/bin/apxs' (or wherever your axps is) and then did a 'make' and 'make install' your httpd.conf should have been updated with the module info. You need to check if the following are there :

LoadModule php4_module libexec/libphp4.so

AddModule mod_php4.c

AddType application/x-httpd-php .php .php4

The second parameter of 'LoadModule' shows the relative (to ServerRoot) path on your system to the DSO module libphp4.so - yours may be different such as modules/libphp4.so .

I'm a bit puzzled by your mention of cgi. PHP doesn't normally come into the cgi arena as such - its just code embedded in html tags. For example the classic test :

<! - PHPinfo.php -->
<html>
<body>
<?php
phpinfo();
?>
</body>
</html>


Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top