Last active
August 29, 2015 13:57
-
-
Save ps/9798701 to your computer and use it in GitHub Desktop.
Installing Apache2 and PHP on Ubuntu 12.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The only simple command you need is: | |
sudo apt-get install apache2 | |
Navigate to: http://localhost and you shall see the magical 'It works!' file! | |
Now to get PHP working: | |
sudo apt-get install php5 | |
sudo apt-get install libapache2-mod-php5 | |
sudo service restart apache2 | |
Now gloriously create a PHP file and marvel at it being executed locally! | |
If you wish to display PHP errors (which are much more helpful than a blank not working page) find your php.ini file. | |
In my case I ended up editing the php.ini that lies in /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini | |
Open up the file and search for and set to 'On' the following: | |
display_errors | |
display_startup_errors | |
html_errors | |
log_errors | |
Also change error_reporting to 'E_ALL | E_STRICT' | |
And finally restart Apache with: | |
sudo service restart apache2 | |
Now you should be on all done! | |
Much simpler than Windows.... | |
References | |
----------- | |
Error reporting thanks to: http://stackoverflow.com/questions/5050426/php-errors-not-being-displayed-in-the-browser-ubuntu-10-10 | |
Apache2 and PHP thanks to: http://www.howtogeek.com/howto/ubuntu/installing-php5-and-apache-on-ubuntu/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment