Problems with mysql+php+apache

nathan r. hruby yellowdog-general@lists.terrasoftsolutions.com
Thu Jan 23 09:18:00 2003


On Wed, 22 Jan 2003 joev_nylxs@pipeline.com wrote:

> What does the apache error say?
> 
> Joe
> 
> > -------Original Message-------
> > From: Carlo.Orecchia@stige-net.com
> > Sent: 01/23/03 07:11 AM
> > To: yellowdog-general@lists.terrasoftsolutions.com
> > Subject: Problems with mysql+php+apache
> > 

[snip]

> > 
> > 
> > We're trying to use this machine with PHP + MYSQL but, when we try to
> > access php code the page come bak blank or with a something that make me
> > believe that the code in not executed, a thing like this:
> > 
> > ------
> > $db_host"); mysql_select_db($database,$link) or die ("Non riesco a
>  > selezionare il DB"); $query_nome = "SELECT nome FROM login"; 

[snip]

This problem is that httpd isn't recognizing the php code as php, and is 
interperting this as text.

Most likely you either do not have the php module loaded in your
httpd.conf file, do not have AddType directives, do not have php start 
and close tags, do not have the php code embded in a page that httpd 
knows to parse for php, or have not restarted the httpd process since you 
made these chnages.

In order to enable the php engine in httpd you need to have the following 
in your httpd.conf file:
---
LoadModule php4_module        modules/libphp4.so
AddModule mod_php4.c
---

In order for httpd to know what file types it should treat as php, you 
need to have the following in your httpd.conf file:
---
AddType application/x-httpd-php .php .php3 .phtml .php4
AddType application/x-httpd-php-source .phps
---

In order for index.php* to be served as a directory index you need to add 
those extensiosn to the DirectoryIndex directinve in your httpd.conf file:
---
DirectoryIndex index.php index.html index.php3 index.htm 
---

After perfoming/verifying the above changes to httpd.conf you need to 
restart apache in order for those changes to be seen by the server.  the 
command "/sbin/service httpd restart" will do this (minus the quotes).

In order for php to know to switch into php mode during the processing of 
a page you need to start your code off with "<?php" and end your code with 
"?>" (minus the quotes of course :)

HTH

-n
-- 
----------------------------------------
nathan hruby <nathan@drama.uga.edu>
computer services specialist
uga drama
http://www.drama.uga.edu/support/
----------------------------------------