Check with curl Apache is up and running (You need to install curl if you haven’t install it)
Apache is working because you get default index with your localhost
Find out your IP address
If your using ethernet your IP is under eth0 or if your using wireless your IP is under wlan0
Curl with your IP address. ( 1.2.3.4 is your IP address )
Same IT WORKS should come what came in localhost.
Enable userdirs so computer users can use public_html folders and restart Apache
Create public_html folder under your home directory and in public_html create index.html
Add simple hello world to index.html so we can be sure userdir works
Curl your users public_html. ( user is your users name. DON’T FORGET TO ADD SLASH END OF THE LINE! )
With curl there should come same code what you added in index.html
You can test page with your firefox too.
Clear default page in /var/www/index.html. ( This is for your own security. )
Erase everything in there so it’s just blank page. So if you curl your IP there should come anything.
Now you have installed Apache.
PHP
Install libapache2-mod-php5 and restart Apache to get PHP working.
Change index.html to index.php so it’s PHP file.
Do simple hello world php file.
To get your php working in userdirs you need to modify php5.conf
Comment lines so your php5.conf file looks like this.
Restart Apache and curl your index.php.
Html code should look like this. So it works!
Now PHP is working too.
MySQL
If you want generated passwords you can use pwgen and generate 20 letter password with it. ( This is not necessary but it’s helps you to get secure passwords )
Install mysql-server and php5-mysql. Restart Apache
If you forget the password you can change it with the following command:
Login to mysql as a root.
Test root works. Create test database and drop it.
MySQL works now.
LAMP
Now let’s test whole LAMP is working together.
Login in as an root and make user person and database person.
Login as person user
Use database person and create table person. In person table add two names: John Doe and Jane FooBar.
Modify old index.php what we created earlier.
Create simple php program that get’s John Doe and Jane FooBar from MySQL and shows them in browser.
Test in your Firefox.
Page should look something like this.
Now you have installed whole LAMP ( Linux, Apache, MySQL, PHP ). You have also tested all those is working together.
Cleaning test data
Of course we don’t want to leave any test data to computer so we erase them.