Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-06-2004, 12:08 PM   #1
Registered: Jan 2004
Location: Hyderabad , India
Distribution: RHL 9
Posts: 42

Rep: Reputation: 15
problems configuring php and apache

Hello All,

Unable to run php files on Linux . php-4.2.2 is preinstalled on RHL 9 .Whenever I run a .php file in the webbrowser(Mozilla) the HTML source code of the file is being displayed instead of the output .

I did all the elementary diagnosis stated in the FAQ's like ....

1) $php -i (enter)

This command results in pagefule of HTML code (This indicates php is working properly).

2)Inserted the following in httpd.conf file ....

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

3)php4 module "" is seen under /etc/httpd/modules

4)$apachectl configtest (enter)
syntax ok (output)

According to the installation_FAQ(php website) if "$php -i" results in loads of HTML code & if HTML source is displayed when the ".php" is run in the webbrowser then it indicates that php is working properly and the problem lies with the webserver configuration .

There is one thing which is bit confusing ...... according to install manual "php.ini" file should be placed under /usr/local/lib ,but i found the file under /etc .

According to FAQ if file is under different location (other than default location ) then following line has to be added ..


But even after adding the line there is no change !

Is the problem with the Apache Webserver or php . Where can I find php configuration file & can I make changes to it once it is installed . I could not find any php directory where such config file could be found .

contents of /var/log/httpd/error_log
[Sat Mar 06 06:47:25 2004] [notice] Digest: generating secret for digest authentication ...
[Sat Mar 06 06:47:25 2004] [notice] Digest: done
[Sat Mar 06 06:47:26 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
[Sat Mar 06 07:55:05 2004] [error] [client] Directory index forbidden by rule: /var/www/html/

Sorry for such a lengthy query ........ its just an effort to give a complete picture .

Plz help me out ..I'm posting this after going through the available FAQ's on the net .

Thx in advance .

Old 03-06-2004, 02:30 PM   #2
Registered: Jun 2003
Posts: 132

Rep: Reputation: 15
Are you using the php module or the php CGI? If you're using the php CGI, you need to specify it as the handler for .php files in apache's config. If you're using the module, make sure apache's config has a LoadModule line to load the php4 module. Make sure that your scripts end in .php

Also make sure you've got the right configs. I don't know exactly what happened, but over the years, the RH server at work ended up with two completely different apache confgs and 3 php.ini files, of which only one of each did anything, and everyone was too scared to erase the extra configuration files.
Old 03-06-2004, 02:42 PM   #3
Registered: Jan 2004
Location: Hyderabad , India
Distribution: RHL 9
Posts: 42

Original Poster
Rep: Reputation: 15
im using php module ,php module is already loaded and when i added LoadModule line "$apachectl configtest" said "php module already loaded skipping the line ........." then i commented that line in httpd.conf file


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
configuring php for apache PennyroyalFrog Linux - Newbie 3 02-07-2008 11:58 PM
configuring apache, php mjl3434 Linux - Software 4 09-22-2005 06:49 PM
Configuring PHP with Apache. LinuxStart Linux - Software 6 07-11-2005 09:15 AM
Configuring php on apache Dakkar Linux - Software 5 06-01-2004 09:26 AM
Problems configuring apache with php filezbyme Linux - Software 1 04-29-2002 10:43 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:57 PM.

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