Firefox wont run my php script. It asks me what to open it with

I’ve just installed the lamp stack. Now I want to test my web pages and php scripts, but when I run one or just try to open a php file with the browser, it doesn’t want to run it. A dialog asks what I would like to use to open a php script. Why doesn’t the browser process the php script?

Fundamental misunderstanding: It’s not the browser that runs the script, it’s the web server.

Your report is short on details. E.g. What software product? SLES? openSUSE? What release? 11.3? 11.4? How did you install the LAMP stack? YaST? What directory did you put your script in?

We are not clairvoyants, you know.

PS: Welcome to the forums.

Browsers never process PHP scripts. That’s the server’s job, and that
you’re seeing Firefox try to do it tell me you have not yet configured
Apache’s httpd service to handle PHP files (recognized by extension) with
the PHP module within Apache. Fix that and the rest should take care of

Good luck.

openSUSE 11.3 here. I installed lamp with YAST. My files are in public_html

I’ve added this line to /etc/apache2/mod_userdir.conf file:
“Include /etc/apache2/conf.d/php5.conf”
as per website instructions to enable php support.
The website I’m reading: SDB:Linux Apache MySQL PHP - openSUSE

Actually the way to do it is to edit /etc/sysconfig/apache2 and add php5 to APACHE_MODULES (make sure the line is the uncommented one, not the example line). I believe you can do this in YaST. Then reconfigure the Apache system with YaST and the PHP module will be included. You can check that it’s loaded with:

/usr/sbin/httpd2 -M

Output should include this line:

php5_module (shared)

BTW, make sure you are accessing the PHP script via the web server, not by browsing your file. I.e.


and not


In the latter case you are not going through the web server.

Things are working now as long as I put my files in /root/srv/www/htdocs. Unless I’m just not navigating correctly to /home/jay/public_html.

You are using something like http://localhost/~jay/ as the URL to access you scripts?

I have got also the problem described by Bird2819, but the situation is very weird. I have installed two machines, one with 11.3 and another with 11.4, in the same way.
The 11.4 machine works perfectly, while the 11.3 machine displays Bird2819’s problem!
More precisely, all my php scripts (on both machines) are store in /srv/www/htdocs/MyDirectory/ and when I access localhost/MyDirectory/MyScript.php as a ‘root’ user it works perfectly, but when I do the same as a regular user, Bird2819’s problem occurs!
Formerly, I used a 11.0 release and the problem never happened. May we conclude that the problem comes from a bug in release 11.3, fixed in 11.4?

I doubt it. PHP works fine for many people on all releases. Make sure you are going through the web server for the PHP scripts and not trying to access them as files. Also what’s this “as root user”? You should not run a web browser as root! There is no reason to run the web browser as root anyway. Any PHP permission issues are on the server side and it’s irrelevant (except for the damage you might cause to your home directories) what user you browse as.

Indeed, a lot of people work, or have worked, on release 11.3.
Nevertheless I have compared carefully my two machine (11.3 and 11.4) and I cannot see any configuration difference.
Does release 11.3 requires modifications in some system files, that I do not know? I remember it was the case with release 11.0.
I agree that running Firefox as root user is not the best practice, but sometime you may learn something from a bad practice. It was the case, since Bird2819’s problem did not occurs.

Francois, on the surface this sounds like a permissions issue. I think, by default, everything in /srv is owned by Root, but you can give any Group (users, www or whatever) write permission to /htdocs. I recall having to do that at least once, perhaps in 11.3?