I'm working on ubuntu 10.10 , n have installed php5 and apache 2 but when I try to open a .php file by giving the complete url in the browser it pops up the window( refer thumbnail).Please help.I'm a beginner and I'm stuck on this god knows since when.

Attachments Screenshot.2_.png 67.08 KB
6 Years
Discussion Span
Last Post by JasonHippy

First up, you might want to try using 'http://' in front of your URL to avoid the URL being interpreted as a 'file://' request. Otherwise, if that doesn't help take a look this. It describes the exact problem you are experiencing and the steps required to solve it:

Troubleshooting PHP 5

Does your browser ask if you want to download the php file instead of displaying it? If Apache is not actually parsing the php after you restarted it, install libapache2-mod-php5. It is installed when you install the php5 package, but may have been removed inadvertently by packages which need to run a different version of php.

If sudo a2enmod php5 returns "$ This module does not exist!", you should purge (not just remove) the libapache2-mod-php5 package and reinstall it.

Be sure to clear your browser's cache before testing your site again. To do this in Firefox 4: Edit → Preferences … Privacy → History: clear your recent history → Details : choose "Everything" in "Time range to clean" and check only "cache", then click on "Clear now".

Remember that, for Apache to be called, the URI in your web browser must begin with "http://". If it begins with "file://", then the file is read directly by the browser, without Apache, so you get (X)HTML and CSS, but no PHP. If you didn't configure any host alias or virtual host, then a local URI begins with "http://localhost", "" or http://" followed by your IP number.

If the problem persists, check your PHP file authorisations (it should be readable at least by Ubuntu user "apache"), and check if the PHP code is correct. For instance, copy your PHP file, replace your whole PHP file content by "<?php phpinfo(); ?>" (without the quotation marks): if you get the PHP test page in your web browser, then the problem is in your PHP code, not in Apache or PHP configuration nor in file permissions. If this doesn't work, then it is a problem of file authorisation, Apache or PHP configuration, cache not emptied, or Apache not running or not restarted. Use the display of that test file in your web browser to see the list of files influencing PHP behaviour.

Taken from the 'Troubleshooting PHP 5' section of this page:
It's published under a Creative Commons Licence, so I guess it's OK to use like this!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.