LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 03-26-2004, 11:04 AM   #1
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Rep: Reputation: 30
Apache + PHP Module


I'm running Fedora, with the latest version of Apache, installed PHP and when I go to view a PHP file locally it just reads the file and display the contents on the screen. I'm pretty sure that the PHP module is loaded correctly into Apache.
 
Old 03-26-2004, 11:07 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Have you also added the correct extension in the httpd.conf file?
 
Old 03-26-2004, 11:08 AM   #3
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
I added it to/etc/httpd/conf.d/php.conf

The files contents are:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php4_module modules/libphp4.so
#
# Cause the PHP interpreter handle files with a .php extension.
#
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
</Files>

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

Last edited by chrisk5527; 03-26-2004 at 11:09 AM.
 
Old 03-26-2004, 11:12 AM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
You should also have something like this in the file:

Code:
# Tell Apache to feed all *.php files through the PHP module
AddType application/x-httpd-php .php
 
Old 03-26-2004, 11:13 AM   #5
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
I should put it in the php.conf file or httpd.conf?
 
Old 03-26-2004, 11:17 AM   #6
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
I tried it in both "php.conf" and "httpd.conf" and neither worked. The permissions the .php file is 777. I've run out of ideas.
 
Old 03-26-2004, 11:18 AM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Quote:
Originally posted by chrisk5527
I should put it in the php.conf file or httpd.conf?
You can usually add it to either and it will work fine.
 
Old 03-26-2004, 11:26 AM   #8
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
Tried both man. Cant figure it out.
 
Old 03-26-2004, 11:36 AM   #9
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Do you get any errors on the output of:

apachectl configtest
 
Old 03-26-2004, 11:39 AM   #10
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
It said the syntax is ok. Any more ideas?
 
Old 03-26-2004, 11:54 AM   #11
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Quote:
Originally posted by chrisk5527
It said the syntax is ok. Any more ideas?
Does it print a blank page or the code still?

If its the code, I would assume php was not compiled with apache properly. Did you install php afterwards or before apache?
 
Old 03-26-2004, 11:57 AM   #12
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
When I opened the file in the web browser it showed the code instead of executing it. I installed PHP after I installed my browser.
 
Old 03-26-2004, 12:00 PM   #13
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
I got it man........ I'm kind of embarrased to say it, but the reason why I was just reading the file instead of executing it is because the webserver had absolutally nothing to do with the file when I was going File/Open. What I did was I copied the directory to /var/www/html and read it like http://127.0.0.1/index.php....
 
Old 03-26-2004, 12:03 PM   #14
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Glad it was something simple... it happens to me all the time, the small and overlooked obvious solutions..
 
Old 03-27-2004, 09:42 PM   #15
angel_hva
LQ Newbie
 
Registered: Mar 2004
Location: Vietnam
Posts: 24

Rep: Reputation: 15
Quote:
LoadModule php4_module modules/libphp4.so
It said could not find libphp4.so
(What can I do now? I installed Php successfully)
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
Installing PHP as an apache module? birv Linux - Software 2 04-05-2004 12:22 PM
Can't load php module in Apache pepino Linux - Newbie 2 10-21-2003 10:26 AM
php static module & dynamic module install. eye Linux - Software 0 10-18-2003 12:16 PM
apache and php module mod_php.so kngharv Linux - General 1 11-21-2001 08:39 PM


All times are GMT -5. The time now is 03:06 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
Open Source Consulting | Domain Registration