Page 1 of 1
PHP files not being treated as PHP
Posted: Sun Apr 08, 2007 11:34 pm
by JasonTC
I have a fresh Debian install with PHP5 and Apache 2. When I try to view PHP pages in a browser, my browser tries to download the PHP page and asks me what type of program I would like to use to open it. I would take this to mean that the server is not parsing the PHP and outputting text like it's supposed to. Any idea what might be the problem?
Thanks,
Jason
Posted: Mon Apr 09, 2007 3:08 am
by timvw
How did you configure apache?
Posted: Mon Apr 09, 2007 9:33 am
by JasonTC
Initially, no configuration. Just did an apt-get install. Then I added something like this to my httpd.conf:
Code: Select all
<VirtualHost 127.0.0.1:80>
ServerName askeet
DocumentRoot "/home/sfprojects/askeet/web"
DirectoryIndex index.php
Alias /sf /usr/local/lib/php/data/symfony/web/sf
<Directory "/home/sfprojects/askeet/web">
AllowOverride All
</Directory>
</VirtualHost>
I did not test any PHP scripts until after the change was made. After I took the change out and restarted Apache, it still didn't work.
Posted: Mon Apr 09, 2007 10:37 am
by Oren
Get rid of what you added there and try to add this instead:
Code: Select all
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/apache2/htdocs"
DirectoryIndex index.php index.html index.cgi index.htm default.htm default.html 403.htm
</VirtualHost>
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
Note that maybe you'll need to change it a bit. I assumed that you installed Apache in your C drive and named its folder "apache2". I also assumed that you installed PHP in your C drive and named its folder "php".
Posted: Mon Apr 09, 2007 10:39 am
by timvw
I'm not really a fan of apt-get when it comes down to configuring stuff... anyway, as oren already mentionned, where is the section that loads the module? and registers files with .php to application/x-httpd-php ?
Posted: Mon Apr 09, 2007 10:47 am
by JasonTC
I'm not really a fan of apt-get when it comes down to configuring stuff... anyway, as oren already mentionned, where is the section that loads the module? and registers files with .php to application/x-httpd-php ?
Actually, I don't think it exists and that's probably my problem. Oren showed a way to add that in Windows. How would I do it on Linux?
Posted: Tue Apr 10, 2007 8:43 pm
by volka
I'm not familiar with debian but
JasonTC wrote:Just did an apt-get install.
exactly what did you install?
There
seem to be many many php packages like e.g. libapache2-mod-php5