5

I have a small index.php that I created by following a tutorial on the official PHP site but cannot see it on localhost.

I formatted my drive, reinstalled Linux Mint, Apache2, PHP5 and MariaDB. No files have been tampered with.

After creating and running index.php from my Bluefish editor, Firefox opens a new tab and immediately prompts me asking if Firefox should open index.php with Bluefish editor. I think my Apache2 isn't configured right.

0
3

The comments thread had a bunch of useful troubleshooting tips but it turned out the issue was with the browser. I recommend having a spare, 'pristine' browser for testing, so if your mimetypes are messed up, you can still check. The OP installed opera and it worked, when firefox didn't. In his shoes, I might consider purging firefox - which eliminates all config files (though resetting it may work) and reinstalling.

Other things worth testing for (Via comments made by myself, agtoever and Dragonlord)

  • Check if apache is running with sudo service apache2 status
  • Check package installs sudo apt-get install php5 libapache2-mod-php5 to make sure apache and the apache/php module is installed. If they are freshly installed, make sure apache is restarted with sudo service apache2 restart
  • Make sure mod_php5 is set up to load when Apache is started. There should be a file in /etc/apache2/mods-enabled called php5.load with the text LoadModule php5_module /usr/lib/apache2/modules/libphp5.so (source). If not, you might want to add this line to /etc/apache2/apache2.conf:

    LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
    
  • Check file permissions.
  • telnet 127.0.0.1 80 to do an oldschool web server test.After some output, type "GET" and enter. Also try this with "GET index.php". This checks if apache2 actually serves your processed php file
  • Check the settings in Firefox and Bluefish. In bluefish go to Edit, Preferences, External Programs. Under Browsers, Mozilla & Opera's command should read: "firefox %s". In Firefox, go to Help, Troubleshooting Information, Profile Directory: Show Folder. Try to delete the mimeTypes.rdf file in the Firefox Profile Folder.
3
  • I want to thank all of you so very much for helping me find a solution to my issue. Who would have ever thought it would be my Firefox browser that I just installed only a couple hours earlier after formatting my drive? You guys are great! Thanks a million =) – fmc Dec 7 '14 at 23:14
  • np. I'd like to add, CWed since most of this answer belongs to the other awesome users who helped out. – Journeyman Geek Dec 7 '14 at 23:21
  • @Landslyde great you found an answer! Happy I could have helped! – agtoever Dec 8 '14 at 6:05
3

My problem was that I was running the PHP files from Bluefish, which sent them to Firefox and appeared in the URL bar as file:///var/www/html/index.php. This is incorrect for PHP files to run on the local machine. Instead, the URL should've read: localhost/index.php. This reflects my index.php file stored in /var/www/html. This is the only way on the local machine that the PHP interpreter will work. I hope this helps someone on down the road.

0

Based on the above answers if you go into bluefish preferences and change firefox to "firefox -remote 'openURL(%p)' || firefox localhost/'%n'&" or make a new one called TestFox with that and set it to default if you want to be safe. It should then work like you want.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.