Why does Firefox repeatedly open new tabs when I open a .php file?

I do web development and design. I've just set up my PC (Ubuntu 14.04 LTS) and installed my choice of software.

On the .php files I set Firefox as the default software to open with but now it opens about 50 odd tabs in the space of 3 seconds. How do I fix this?

1 Answer

To parse a php file, you need a server set up (apache for example) and you need firefox to query for this file with the server. So install apache (or a server of your preference), set the DocumentRoot.

Now you can try typing the URL of the file relative to DocumentRoot in the addressbar of firefox, like so: localhost/index.php. This will open the file normally.

Explanation:

What's happening is, firefox doesn't process a php file by itself, it doesn't know how. So when you open it, it treats it as a file to be downloaded and opened, so it downloads and tries to open it. Now since the default software to open a php file is firefox itself, a new tab is opened, and the whole process repeats indefinitely.

When you type the address of the file in addressbar, firefox actually makes a request to Apache (or whichever server) for the file, and the server will do the task of parsing php and converting it into HTML.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like