LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 05-13-2010, 11:28 AM   #1
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 382

Rep: Reputation: 30
Apache downloads php file instead of running script


I trashed my Karmic Ubuntu install and installed Lucid (I had heard that the boot times were much reduced and I didn't see any improvement in my normal upgrade).

I reinstalled Drupal but find that my installation of Apache does not run the scripts, but rather passes the php text file to the browser.

IIRC when I installed it apt configured Apache correctly without me having to edit .htaccess or /etc/apache2/httpd.conf which makes me think that I am missing a key dependency.

Does anyone know of a check list to which I can refer to make sure that I've installed everything?

My installation has Postgres instead of MySQL.

Failing which, in the event that my memory is faulty, where can I find which changes need to be applied to the configuration files above?

Last edited by cov; 05-13-2010 at 11:42 AM.
 
Old 05-13-2010, 12:15 PM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,121

Rep: Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819
There are, usually, two reasons that PHP won't run in Apache -- PHP is not being loaded or index.php is missing.

PHP gets loaded by, down toward the bottom of httpd.conf
Code:
# Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf
or you may need (in httpd.conf)
Code:
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
And a third reason may be that PHP is not installed at all?

Hope this helps some -- and don't forget to stop and restart httpd if you change anything in httpd.conf.
 
Old 05-13-2010, 12:27 PM   #3
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 382

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by tronayne View Post
There are, usually, two reasons that PHP won't run in Apache -- PHP is not being loaded or index.php is missing.

PHP gets loaded by, down toward the bottom of httpd.conf
Code:
# Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf
or you may need (in httpd.conf)
Code:
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
And a third reason may be that PHP is not installed at all?

Hope this helps some -- and don't forget to stop and restart httpd if you change anything in httpd.conf.
???

My /etc/apache2/httpd.conf file is EMPTY!

Moreover there is no /etc/httpd/ directory.

So the installation is borked. Reinstall apache?
 
Old 05-13-2010, 03:30 PM   #4
space_mokey
LQ Newbie
 
Registered: May 2010
Posts: 8

Rep: Reputation: 0
selinux

I was having a similar problem on a centos server a while back, It turned out to be selinux, I set it to passive and worked like a charm.
 
Old 05-13-2010, 05:33 PM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,121

Rep: Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819Reputation: 819
Quote:
My /etc/apache2/httpd.conf file is EMPTY!

Moreover there is no /etc/httpd/ directory.

So the installation is borked. Reinstall apache?
Uh, OK, do you have httpd.conf somewhere else? Or do you have a "httpd.whatever" that is to be copied to httpd.conf and edited (possibly in /etc/apache2)?

Sometimes your mileage may vary -- looks like your installation is in /etc/apache2 rather than /etc/httpd. There ought to be an httpd.something-or-other file that you're supposed to copy into httpd.conf and edit. There also ought to be a php.ini (or php.ini-recommended or php.ini-dist) sitting in there (or someplace else?) for you to edit (you want to wind up with php.ini and include that in your httpd.conf) and the same for php_mod.conf).

Seems like most distributions install stuff where it ought to be and yours may just have used apache2; files and methods are the same, however.

Hope this helps some.
 
  


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/shell script to install mysql,apache and php automatically stranger_6_7 Linux - General 2 08-11-2009 03:07 AM
Centos 5.2 running Apache 2 and PHP 4 cannot display info.php codenjanod Linux - Server 2 08-19-2008 03:00 AM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 10:10 PM
Running shell script with PHP in Apache mr_scary Programming 2 10-20-2006 05:17 PM
Probs running .jar file via CGI script under Apache blimbo Programming 1 07-22-2004 11:29 AM


All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
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