LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PHP not interpreted by Apache in Red Hat linux enterprise 4 (https://www.linuxquestions.org/questions/linux-newbie-8/php-not-interpreted-by-apache-in-red-hat-linux-enterprise-4-a-700982/)

sohailkmu 01-30-2009 03:58 AM

PHP not interpreted by Apache in Red Hat linux enterprise 4
 
I want to have a LAMP Server.I have installed all the three rpms of Apache, MySql and PHP.

The Apache server can be accessed. files with .html extensions can be interpreted but with .php it is doing nothing.

Can any body help me.

Didier Spaier 01-30-2009 04:08 AM

Edit httpd.conf to have :
Code:

    DirectoryIndex index.html index.php
    AddType application/x-httpd-php .php
Include /etc/httpd/mod_php.conf

The settings should be there, only uncomment or edit it accordingly.

Do the same for mod_php.conf so you have uncommented:
Code:

AddType application/x-httpd-php .php
Then, restart Apache.

sohailkmu 01-30-2009 11:14 PM

sohail
 
Quote:

Originally Posted by Didier Spaier (Post 3426126)
Edit httpd.conf to have :
Code:

    DirectoryIndex index.html index.php
    AddType application/x-httpd-php .php
Include /etc/httpd/mod_php.conf

The settings should be there, only uncomment or edit it accordingly.

Do the same for mod_php.conf so you have uncommented:
Code:

AddType application/x-httpd-php .php
Then, restart Apache.

Dear thanks a lot for your timely help.

But there is no mod_php.conf in /etc/httpd. Where should I include it.

The other two lines mentioned by you have already been added to httpd.conf but still it is not working.

Didier Spaier 01-31-2009 01:20 AM

mod_php.conf could be elsewhere, or still to be created from the template mod_php.conf.example. To find out do this as root:
Code:

updatedb
then
Code:

locate mod_php.conf
What is your Apache version ?

sohailkmu 01-31-2009 02:13 AM

sohail
 
Quote:

Originally Posted by Didier Spaier (Post 3426973)
mod_php.conf could be elsewhere, or still to be created from the template mod_php.conf.example. To find out do this as root:
Code:

updatedb
then
Code:

locate mod_php.conf
What is your Apache version ?

there is no output of locate mod_php.conf after applying updatedb command.

The output from error_log of httpd is as under:

[Sat Jan 31 00:02:13 2009] [error] [client ::1] File does not exist: /var/www/html/favicon.ico
[client ::1] PHP Warning: Unknown(/var/www/html/phpinfo.php): failed to open stream: Permission denied in Unknown on line 0
[client ::1] PHP Warning: (null)(): Failed opening '/var/www/html/phpinfo.php' for inclusion (include_path='.:/usr/share/pear') in Unknown on line 0

Didier Spaier 01-31-2009 05:17 AM

Something should be wrong with your Apache installation. Save following line:
Code:

AddType application/x-httpd-php .php
as /etc/httpd/mod_php.conf and restart Apache.

jstephens84 01-31-2009 09:37 AM

Did you add the LoadModule php5_module 'path to module' to you httpd.conf file.

3rods 01-31-2009 09:54 AM

Code:

[client ::1] PHP Warning: Unknown(/var/www/html/phpinfo.php): failed to open stream: Permission denied in Unknown on line 0
That looks like a permissions problem.

Sohailkmu, does the user that apache runs under have permissions to the /var/www/html folder? I's usually www-data unless you changed it in the envvars file.

sohailkmu 02-02-2009 01:55 AM

Quote:

Originally Posted by 3rods (Post 3427299)
Code:

[client ::1] PHP Warning: Unknown(/var/www/html/phpinfo.php): failed to open stream: Permission denied in Unknown on line 0
That looks like a permissions problem.

Sohailkmu, does the user that apache runs under have permissions to the /var/www/html folder? I's usually www-data unless you changed it in the envvars file.

Thanks a lot for pointing out the exact fault.
There was a problem with the permissions. The problem has been solved. thank you once again


All times are GMT -5. The time now is 03:08 AM.