I have created a webserver with apache2 and it seems to run fine . I have also installed php5 on the server .To test if php is working , i have created a test.php with a phpinfo() function call and put this file in /var/www. whenever I point my browser to the php file location it asks me to download the file rather than running it . What's wrong here?
For some reason PHP is not running. Make sure:
- You have restarted Apache after the install
- PHP is actually loaded into Apache (eg in Ubuntu you need also libapache2-mod-php5 and not just php5)
If both apply, please indeed post Apache config files.
There are several things to do:
1- You need to make sure that the appropriate php module is installed. Use;
dpkg -l | grep php to list the php related packages.
2- You need to make sure you have a line similar to this in your apache configuration. This line enable the execution of PHP files under specific directory.
AddType application/x-httpd-php .php
3- You just need to reload/restart your apache server after applying the needed changes.