Skip to content

LAMP Initialization for Projects (For Beginners)

rajeefmk edited this page Apr 7, 2014 · 4 revisions

PHP

Run localhost in the web browser. Check for message (”it works”).

And

Create a php file with codes

<?php_

_phpinfo();

_?>

& run localhost command again in the web browser

It should give info about PHP.

Apache (for versions before 2.4.9)

( check version of Apache apache2 -v )

cd into apache folder ( cd /etc/apache2/sites-available)

Enter the code in terminal

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/crowdfunding

Then enter code -

sudo gedit crowdfunding

Inside the editor do the following :

The apache server by default points to /var/www .It needs to pointed to the git repo in your system. Get the location of the git repo using pwd command inside the terminal after "cd"ing into the your git repo folder. At two places& change them at two places

from /var/www/ to “location of git repo”

save the file & exit gedit. Get back to the terminal

Enter the following codes, executing one after the other.

sudo a2dissite default sudo a2ensite crowdfunding sudo service apache2 restart

command for streaming the apache error log tail -f /var/log/apache2/error.log

Apache (For versions 2.4.9 and above)

cd into apache folder ( cd /etc/apache2/sites-available)

Enter the code in terminal

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/crowdfunding.conf

Then enter code -

sudo gedit crowdfunding.conf

Inside the editor do the following :

The apache server by default points to /var/www .It needs to pointed to the git repo in your system. Get the location of the git repo using pwd command inside the terminal after "cd"ing into the your git repo folder.

Look for DocumentRoot and change /var/www/ to “location of git repo” ( Eg: /home/rj/work_git/crowdfund-scholarships). save the file & exit gedit.

Now enter code -

sudo gedit default-ssl.conf

Look for DocumentRoot and repeat above step.

Save & close the editor & cd into apache2 folder ( cd .. ).

Now enter code -

sudo gedit default-ssl.conf

Copy the directory tag below, replace /var/www with your git repo directory, & paste it in the file right below where this tag ends. <Directory /var/www> ..

<Directory /var/www> Options Indexes FollowSymLinks AllowOverride None Require all granted

Enter the following codes, executing one after the other.

sudo a2dissite 000-default.conf sudo a2ensite crowdfunding.conf sudo service apache2 restart

PS : Test this by typing localhost in the web browser. If any error, run the following code

sudo apt-get install libapache2-mod-php5 sudo service apache2 restart

MySql

To access database "cd" into the

first time - } mysql -u root -p < LearnEmp.sql

( -u root implies root user & -p is for entering password).

enter password you had registered the first time when installing Lamp.

Next time, use _myql -u root -p_