Firefox can't open php file from apache2 server on localhost
Hi.
I've just moved on to 10.04 from 9.10. The program worked fine in 9.10. I *may* have overwritteen a conf file in the upgrade... :redface:
I now get the error as below:
http://www.grassmoon.com/ubuntu/php_prob_01.png
My userdir.conf is like this:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
and I have the PHP5 module installed. I vaguely recall that I may have had PHP4 installed - would the upgrade have removed it? Is there anywhere I can get it from to try? Anything else to do?
Thanks for your time
Makrie :D
Re: Firefox can't open php file from apache2 server on localhost
What do you see when you run php -v from the command line?
Do you have libapache2-mod-php5 installed?
Have you installed everything from the repositories or do you have bits installed manually or from other sources?
Apache is not configured to server php files, which is why you are getting this error. It may be a simple error in a configuration file.
Re: Firefox can't open php file from apache2 server on localhost
Quote:
Originally Posted by
Makrie
Hi.
I've just moved on to 10.04 from 9.10. The program worked fine in 9.10. I *may* have overwritteen a conf file in the upgrade... :redface:
I now get the error as below:
http://www.grassmoon.com/ubuntu/php_prob_01.png
My userdir.conf is like this:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
and I have the PHP5 module installed. I vaguely recall that I may have had PHP4 installed - would the upgrade have removed it? Is there anywhere I can get it from to try? Anything else to do?
Thanks for your time
Makrie :D
Yes, richardjh you allright!
Code:
$sudo apt-get install libapache2-mod-php5
Re: Firefox can't open php file from apache2 server on localhost
I had a similar problem with firefox wanting to download PHP files instead of displaying them. I found the answer here: https://help.ubuntu.com/community/Ap...ting%20PHP%205
Re: Firefox can't open php file from apache2 server on localhost
Hi all, thanks for helping me with this.
Quote:
Originally Posted by
richardjh
What do you see when you run php -v from the command line?
marko@mango:~$ php -v
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHP 5.3.2-1ubuntu3 with Suhosin-Patch (cli) (built: Mar 29 2010 12:23:29)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Quote:
Do you have libapache2-mod-php5 installed?
Yes, I believe so.
Quote:
Have you installed everything from the repositories or do you have bits installed manually or from other sources?
One of the reasons I didn't clean install 10.04 was that I wanted to keep Fontlinge working without needing to reinstall it. I had installed Fontlinge manually but everything else (Apache,PHP5,etc.) from the repositories.
Quote:
Apache is not configured to server php files, which is why you are getting this error. It may be a simple error in a configuration file.
Fingers crossed for finding it! Apache2 config files are default (my bad, I overwrote my custom one, I think)!
Quote:
Originally Posted by
lisati
Following their advice:
marko@mango:~$ sudo a2enmod php5
[sudo] password for marko:
Module php5 already enabled
marko@mango:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
and the problem remains. I manage the modules through Webmin, fwiw.
Thanks all!
Re: Firefox can't open php file from apache2 server on localhost
Edit: change the file in mods-available not in enabled. Sorry for the mistake.
Try to open the php5.conf in mods-available
Code:
sudo nano /etc/apache2/mods-available/php5.conf
It should look like this
Code:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
If the .php is not there apache will not parse the files.
Force apache to reload the module.
Code:
sudo a2dismod php5
sudo service apache2 restart
sudo a2enmod php5
sudo service apache2 restart
Re: Firefox can't open php file from apache2 server on localhost
Quote:
Originally Posted by
s_ø
Try to open the php5.conf in mods-enabled.
Code:
sudo nano /etc/apache2/mods-enabled/php5.conf
It should look like this
Code:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
If the .php is not there apache will not parse the files.
Force apache to reload the module.
Code:
sudo a2dismod php5
sudo service apache2 restart
sudo a2enmod php5
sudo service apache2 restart
Even after reloading the module as you specified, my php5.conf still looks very different:
GNU nano 2.2.2 File: /etc/apache2/mods-enabled/php5.conf
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>
Should I replace it with yours?
And thanks!
Re: Firefox can't open php file from apache2 server on localhost
This is a pretty fancy expression for something simple
Code:
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
I think you can safely replace it with this.
Code:
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
Edit:
The reqex should work, so its probably not that.
Re: Firefox can't open php file from apache2 server on localhost
try to comment out the bold lines. (I think the syntax has changed to the semicolon ; for comments.
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
Re: Firefox can't open php file from apache2 server on localhost
Quote:
Originally Posted by
s_ø
try to comment out the bold lines. (I think the syntax has changed to the semicolon ; for comments.
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
I've commented out the lines (attempted twice, using semicolons and hashes) and still no joy. I have been clearing my internet cache before and after every restart of Apache2.
Darn! Any further ideas? Am I approaching clean install time? Could it be that the program wants PHP4 not PHP5 (although I don't think the error message suggests this?
Thanks :/