Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 08-06-2009, 03:47 PM   #1
Registered: Jun 2005
Location: Salonica
Distribution: Xubuntu
Posts: 40

Rep: Reputation: 15
Firefox does not recognise php files and ask what to do with them


I am lately trying to work my way with LAMP, so I have installed Apache, Php and MySql and also PhpMyAdmin.
The problem I have noticed is that firefox cannot handle .php files. Instead it treats them like unkwon type and ask instructions for handling them (save, open with..).
They are not prosessed by the server so no content is displayed.

I have read some suggestion about similar problems but nothnig seems to work for me.
I have tried the followings:

1.Added the line AddType application/x-httpd-php .php .php3 .phtml
in my /etc/apache2/apache2.conf file

2.Added the line AddType application/x-httpd-php .php .php3 .phtml
in my /etc/apache2/httpd.conf file (it was empty before)

3.Checked if php module is enabled by a2enmod php (it was)

4.Installed epiphany to see if it was a server problem (it handles simple php files fine -so it is a problem of firefox-)

5.Checked the existense of /etc/apache2/mods-enabled/php5.conf and /etc/apache2/mods-enabled/php5.load files (there were present)

6.Cleared my cache of firefox! (as I have read in a thread)

7.Also created new profile in firefox (also read in a thread) but pointless also!

I am not sure I am missing something but I think that's all I tried.
Any suggestions?
Old 08-06-2009, 06:01 PM   #2
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
i don't think this is firefox problem
if you can visit for example in firefox thats server problem (i think you messed up somewhere already)

if you use apache2 mime types is in
but even there there is no explict line about php it just refers to /etc/mime.types
where i can see
application/x-httpd-php phtml pht php
application/x-httpd-php-source phps
application/x-httpd-php3 php3
application/x-httpd-php3-preprocessed php3p
application/x-httpd-php4 php4
i think possibly this can be dual apache+firefox problem so check if you have something like that(mime.types may have different location on your system)
check strace firefox if it uses this file)

if this not helps try to run apache binary with -t param it will check config files(read output!)(apache2ctl -t on ubuntu)
Old 08-07-2009, 01:45 AM   #3
Registered: Jun 2005
Location: Salonica
Distribution: Xubuntu
Posts: 40

Original Poster
Rep: Reputation: 15
Thanks for the quick response,

I checked the link you indicated and as you expected it loaded just fine.
I also checked the /etc/apache2/mods-enabled/mime.conf file and I added some reference to php just in case but no avail.

I will check with strace firefox and report back.
Old 08-07-2009, 03:20 AM   #4
LQ Newbie
Registered: Jun 2008
Location: Ontario, Canada
Distribution: Slackware
Posts: 7

Rep: Reputation: 5
eypros: you're right. Firefox hasn't a clue what to do with php files. So, if you tell it to open one like this

bash$ firefox /path/to/php/file/file.php
it will not work because you are bypassing the web server entirely. So, try:

and I bet it'll work.
Old 08-07-2009, 05:39 AM   #5
Registered: Jun 2005
Location: Salonica
Distribution: Xubuntu
Posts: 40

Original Poster
Rep: Reputation: 15

Yes I have noticed the same. It works with php files but need to be instructed explicitly which the protocol is. Anyway thanks, I will be using this syntax from now on.
Old 08-07-2009, 07:22 AM   #6
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
Let's make this clear normal browser supports http prtocol (in some cases https / ftp and others by plugins, also javascript: hack )
Rendered content may be HTML / JS / CSS (and provided by plugins embedded/ slick / flash / in some cases php and others )
So what apache+php on server side do? apache get page pass it to associated compiler in this case php and push output to browser(in general cases this is generated by php html/css/js).
So to call apache service you need to access it by http://machine_name_with_web_server ( in your case it translated to http://(expected protocol alias) localhost(alias for local machine) :80 (port this is default port for http protocol service, autoadded by http://)

If you just run firefox phpfile.php apache will not touch this file as it wait request on 80 port, instead firefox will load and try to parse param phpfile.php as it have not by default any bindings to php to compile this file it will treat it as default downloadable file.

if you still have will to test file without apache (just to see output html) you can do this
echo "<? echo \" PHP output test\" ?><BR> HTML output test" > tst.php && \
php tst.php > out.html && firefox out.html && rm tst.php && rm out.html
Old 08-09-2009, 05:06 AM   #7
Registered: Jan 2007
Location: Vienna
Distribution: Redhat
Posts: 47

Rep: Reputation: 19
Let's have a simple test to check whether your lamp configurations are right.

add test.php to your document root of apache which has following content in it

phpinfo ()

and call this page using the URL http://yourwebserver/test.php.

if you get the similar error then it is sure that php module for apache is not getting loaded when apache restarts.

if it is the case, and i think you are using SUSE ? then add "php5" to /etc/sysconfig/apache2 's module config


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
test26.s doesn't recognise DVD drive, other kernels won't recognise HDD v@ny@ Slackware - Installation 15 05-31-2007 06:03 AM
valknut doesn't recognise my vfat files amitprabhakar Fedora 1 06-06-2006 11:14 AM
Suse 10-64bit-OSS. Can't get Firefox to recognise Realplayer is installed patslap Linux - Newbie 2 11-14-2005 02:18 PM
Firefox won't read .php files Lagg Linux - Software 1 05-06-2005 12:40 AM
gcc won't recognise local header files surio Linux - Software 0 09-10-2003 05:02 PM > Forums > Linux Forums > Linux - Server

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration