Sunday 7 February 2016

Setting up PHP Mysql in Linux

We are familiar with WAMP in windows for running PHP applications. Like wise it is Known as LAMP in Linux. LAMP stands for Linux Apache Mysql PHP

Below I will show step by step  instruction on how to install it.

1) First step is we have to install Apache. For this :-
Open Terminal(Applications->Accessories->Terminal)

sudo apt-get install apache2

Then it will ask you for password & type enter.

2) Test whether it is installed correctly or not. For this type http://localhost in the browser url. It will give a page if its correctly installed.

3) Next step is to install PHP. For this type the following in the Terminal & press enter

sudo apt-get install php5 libapache2-mod-php5

4) Now restart apache to make php compatible with apache. Type the following in terminal & press enter

sudo /etc/init.d/apache2 restart

5) Next step is to install Mysql. For this Type following in the terminal & press enter
sudo apt-get install mysql-server


6) Next step is to instal;l PHPmyadmin, which is an easy tool to edit our databases. For this type the following in terminal & press enter
sudo apt-get install libapache2-mod-auth-mysql  php5-mysql  phpmyadmin

7) Next step is to make mysql work with PHP , for this we have to open PHP configuration file and enable mysql extension in it.
gksudo gedit /etc/php5/apache2/php.ini

Find the Line
;extension=mysql.so   
Remove the semicolon which will look like this
extension =mysql.so

8) Now Just restart the apache
sudo /etc/init.d/apache2 restart

9) Now check if its working by typing localhost/phpmyadmin in your browser. if its giving error then
we have to edit apache2.config file .Type following Line & press enter
sudo gedit /etc/apache2/apache2.conf

Include the following line in the bottom of the page..

Include /etc/phpmyadmin/apache.conf


10) Now Just restart apache & check..

sudo /etc/init.d/apache2 restart

To find out strict mode status, run the below sql

SHOW VARIABLES LIKE 'sql_mode';

If the output value contains STRICT_TRANS_TABLES, then strict mode is enabled.

To disable strict mode, run the below sql

SET GLOBAL sql_mode = '';

To enable strict mode, run the below sql

SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES';

 


Now Everything will be working fine... Enjoy...



No comments:

Post a Comment