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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with APACHE!

Status
Not open for further replies.
Joined
Jan 15, 2001
Messages
80
Location
US
I have apache up and running with php compiled in, but when I try to open a doc or
page that's supposed to execute some php
script, I get the php code. It's like the
php is not included in apache.

Any ideas?

Thank you!
 
Have you enabled PHP in apache?

in /etc/httpd/conf/httpd.conf

LoadModule php4_module modules/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php3 .php .php4 .phtml
AddType application/x-httpd-php-source .phps

This works for a Redhat config. Bruce Garlock
bruceg@tiac.net
 
The best way to install PHP is from the source code, as a DSO module. Get it from
Extract the files into the server.
# cd /usr/local/src
# tar xzvf /<download directory>/php-4.1.2.tar.gz

Then create a file with all the configuration options for the source compilation.
# cat > build.sh
./configure --with-apxs=/usr/local/apache/bin/apxs --enable-debug=no --enable-safe-mode --with-mysql=/usr/local/mysql --with-exec-dir=/usr/bin --with-regex=system --with-xml

In most cases the default options will do, but -apxs is essential and --with-mysql will compile support for the MySQL DB into the module.

After that, it's just a case of
# ./build.sh
# make
# make install

Ensure that httpd.conf contains the following lines:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c

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

That should do it (don't forget to restart apache though).

A simple test example:

<!-- HelloWorld.php -->
<html>
<body>
<?php
echo &quot;Hello World -- PHP works!&quot;
?>
</body>
</html> ------------------------------------------------------------------
It's important to think. It's what separates us from lentils.
 
I made and verified the above suggestions and
got the same results on a redhat 7.2 and suse 7.3 distros. The only difference was that I
installed apache with all the php stuff when I installed the suse os.
 
Which apache are you using? I had problems with v2, so I've gone back to v1.3.24 for the moment.

Also, what are you seeing on your browser? ------------------------------------------------------------------
It's important to think. It's what separates us from lentils.
 
It mustbe something I've missed doing since I get the same results in a preinstalled(suse 7.3) and a build from scratch(red hat 7.2).
On both distros, Apache comes up ok, I just
can't execute any .php stuff.
 
What do the entires in /etc/httpd/conf/httpd.conf look like? If apache starts up ok (without errors) and you have the correct entires in httpd.conf, then I would start looking at your logs for any indication of why this is not working. Look in /var/log/httpd/error_log Bruce Garlock
bruceg@tiac.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top