LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-30-2009, 03:58 AM   #1
sohailkmu
Member
 
Registered: Oct 2008
Posts: 81
Blog Entries: 1

Rep: Reputation: 15
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.
 
Old 01-30-2009, 04:08 AM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-14.1 on a Lenovo T61 6457-4XG
Posts: 4,021

Rep: Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966
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.

Last edited by Didier Spaier; 01-30-2009 at 04:10 AM. Reason: A filename was wrong
 
Old 01-30-2009, 11:14 PM   #3
sohailkmu
Member
 
Registered: Oct 2008
Posts: 81
Blog Entries: 1

Original Poster
Rep: Reputation: 15
sohail

Quote:
Originally Posted by Didier Spaier View Post
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.

Last edited by sohailkmu; 01-30-2009 at 11:15 PM.
 
Old 01-31-2009, 01:20 AM   #4
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-14.1 on a Lenovo T61 6457-4XG
Posts: 4,021

Rep: Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966
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 ?
 
Old 01-31-2009, 02:13 AM   #5
sohailkmu
Member
 
Registered: Oct 2008
Posts: 81
Blog Entries: 1

Original Poster
Rep: Reputation: 15
sohail

Quote:
Originally Posted by Didier Spaier View Post
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
 
Old 01-31-2009, 05:17 AM   #6
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-14.1 on a Lenovo T61 6457-4XG
Posts: 4,021

Rep: Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966
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.
 
Old 01-31-2009, 09:37 AM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
Did you add the LoadModule php5_module 'path to module' to you httpd.conf file.
 
Old 01-31-2009, 09:54 AM   #8
3rods
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 16
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.
 
Old 02-02-2009, 01:55 AM   #9
sohailkmu
Member
 
Registered: Oct 2008
Posts: 81
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by 3rods View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 5 for Red Hat Enterprise?? blizunt7 Linux - Software 1 08-08-2007 05:47 PM
LXer: Red Hat to launch Red Hat Enterprise Linux 5 before March LXer Syndicated Linux News 0 12-30-2006 08:03 AM
Upgrade PHP in Red Hat Enterprise v4 hbmus080 Red Hat 4 05-11-2006 09:18 AM
Apache Ant and Red Hat Enterprise WS 4 AsymptoticOrbit Red Hat 4 08-22-2005 08:02 PM
move ssl from ibm httpserver to apache on Red Hat Enterprise Linux 3 wealth2k Linux - Security 4 06-30-2004 02:31 PM


All times are GMT -5. The time now is 04:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration