I installed apache2, php5 and mysql. http://localhost/ url in browser shows it works. I saved a php file in /var/www/ as testphp.php. Code in the file is..
<?php
phpinfo();
?>
Now on entering http://localhost/testphp.php in browser, it gives this error..

I don't understand why this is happening. Can anyone explain how to work with php? Also please explain how to connect php with mysql server installed on my system.
EDIT : I open the file from terminal in gedit. When I edit some text in the file, these warnings appear in the terminal..
(gedit:28157): Gtk-WARNING **: Calling Inhibit failed:
GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
EDIT2 : I saved the file to /var/www/html but still get the error.