LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-02-2008, 06:01 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 49
Not able to run PHP files on my apache2 webserver


I recently installed Apacache2, php from this website:
http://www.debianadmin.com/apache2-i...ian-linux.html

I can access my webserver when I type http://localhost. I can see the default HTML page that is placed in the root directory of webserver. Unfortunately I am not able to run any PHP files. When I try to type the URL in my browser like this:
http://localhost/apache2-default/info.php

The file just downloads (I get the firefox download box) instead of actually running on the websever.

The contents of PHP info are as follow:
Code:
<html><head><title>PHP Info</title></head>
<body>
<?php phpinfo(); ?>
</body></html>
What am I missing?
 
Old 03-02-2008, 06:08 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Did you update your .conf file as the following recommends?
Code:
If you want to allow the different index files types check for the following line in /etc/apache2/apache2.conf file:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml
Also, in your .conf files after all of the installs are there lines like these (I'm using PHP 5)?
Code:
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
 
Old 03-02-2008, 06:20 PM   #3
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by gilead View Post
Did you update your .conf file as the following recommends?
Code:
If you want to allow the different index files types check for the following line in /etc/apache2/apache2.conf file:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml
Ok, I added the above line in my apache2.conf file


Quote:
Originally Posted by gilead View Post
Also, in your .conf files after all of the installs are there lines like these (I'm using PHP 5)?
Code:
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
In which .conf file should I add these?

Yes, I am using php5.

Thanks for the help.
 
Old 03-02-2008, 06:29 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I just re-read the linked info in your original post. It seems like the directives should already be there. You could confirm it by using grep recursively on the directory containing apache2.conf and its sub-directories. The page also talks about a2enmod which enables module functionality.

If it's there, based on the info here you may be able to run a2enmod php5 to enable it. If it's not there, I'd search for files near apache2.conf containing LoadModule or AddType and add it there.

Note, what I know about Debian would fit in a mouse's ear without touching the sides. I'm used to the manual approach because that's what I do in other distros...
 
Old 03-02-2008, 10:17 PM   #5
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by gilead View Post
Note, what I know about Debian would fit in a mouse's ear without touching the sides. I'm used to the manual approach because that's what I do in other distros...
What do you mean by manual approach? Is there any other way to install it?
 
Old 03-02-2008, 10:41 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You should be able to use Debian's package manager to install the packages. The listing of Debian Stable's packages shows packages for Apache 2 (2.2.3-4+etch4) and PHP 5.
 
Old 09-29-2009, 03:25 PM   #7
AndeAnderson
Member
 
Registered: Feb 2005
Location: Pennsylvania
Distribution: Debian (maybe)
Posts: 237

Rep: Reputation: 30
Unhappy

I know this is an old post. However, I have the same problem. I can not use any of the php files. I could not find anything called 'DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml' in the /etc/apache2/apache2.conf file. And, the httpd.conf file appears to be empty.

I do have all of the packages and modules I could find listed for using PHP5 in Debian with the Apache 2.2 Server installed. The only response I can get is "The requested URL http://localhost/home/ande/ was not found on this server.'

The only clear instructions I have found so far are only dealing with installing onto a server on the internet. Everything for using the localhost are one or two word phrases and no help.

I would surely appreciate some actual information on the configuration required for using PHP5 on the LocalHost. Especially since it was installed using the Package Manager with no errors and everything indicates PHP5 is installed and available.

Thanks

Quote:
Originally Posted by gilead View Post
Did you update your .conf file as the following recommends?
Code:
If you want to allow the different index files types check for the following line in /etc/apache2/apache2.conf file:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml
Also, in your .conf files after all of the installs are there lines like these (I'm using PHP 5)?
Code:
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
 
Old 10-01-2009, 04:41 PM   #8
pliqui
Member
 
Registered: Feb 2007
Location: Caracas, Venezuela
Distribution: Debian x64
Posts: 156

Rep: Reputation: 17
Hello,

1.- Did you install apache2 and php5 from repos?

2.- where exactly are you putting the .php file in the filesystem? i think you are putting the file in the wrong directory, apache's document root directory is in /var/www not /home/ande.

Check that and tell me if that work

Last edited by pliqui; 10-01-2009 at 04:41 PM. Reason: typo
 
  


Reply



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
Apache2 won't load index.php files foucault Linux - Software 11 03-20-2010 09:08 PM
Can't access my apache2 webserver using external address from LAN eldoran Linux - Networking 6 10-26-2008 03:51 PM
Apache2 is serving PHP source files unless called without the extension rjlee Linux - General 3 12-08-2006 06:17 AM
.php files running on a linux webserver graziano1968 Linux - Networking 2 10-24-2006 12:54 AM
Apache 2, PHP 5, SuSE 9.2 - cannot run php files dickohead Linux - Networking 6 06-28-2006 10:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:12 PM.

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
Open Source Consulting | Domain Registration