LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   php5 not working with apache2 in debian 4.0 (https://www.linuxquestions.org/questions/linux-server-73/php5-not-working-with-apache2-in-debian-4-0-a-575748/)

mohtasham1983 08-08-2007 07:49 PM

php5 not working with apache2 in debian 4.0
 
I have installed Debian 4.0 at my friend's computer. It didn't have apache2 by default so I installed it from sarg repository. I noticed that httpd.conf was changed to apache2.conf so it didn't allow me to start the server. After eliminating this problem I installed PHP5 with libapache2-mod-php5.

Then I added following lines to apache2.conf:

Code:

# Use for PHP 5.x:
LoadModule php5_module        /usr/lib/apache2/modules/libphp5.so       
AddHandler php5-script php

# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php

AddType text/html      php

# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps

I found libphp5.so in /usr/lib/apache2/modules/ so I added all address path to it. When I restart apache it doesn't give me any error, but when I try to open a php file, it tries to download it instead.

I have installed php and apache several times in fedora 3,4 and all ubuntu versions, but I never thought that installing it on Debian is so difficult. I just chose Debian, because of its famous stablity. I am even thinking about installing ubuntu server instead of Debian, since ubuntu has been very stable for me as a desktop OS and softwares that are coming with it are from latest versions. However, I have never seen any recommendation of installing ubuntu as a server.

I will really appreciate if you help me.

Thank you in adcance.

mohtasham1983 08-08-2007 08:02 PM

I just noticed that all those lines that I added to apache2.conf files are already in mods-available/ directory.

mohtasham1983 08-08-2007 09:19 PM

I just figured out how to make it working. I'm going to explain what I did for those who may encounter such problem.

What I did was very simple. You should disable all repositories and install everything from:

Code:

deb ftp://ftp2.fr.debian.org/debian/ stable main contrib non-free

At first I tried to install it using a repository with unstable programs.

Then you have to add everything I mentioned in my first post to apache.conf file.


I hope this thread can help some people.


All times are GMT -5. The time now is 12:49 AM.