0% found this document useful (0 votes)
22 views3 pages

Installing LAMP Stack on Linux

This document provides instructions to install the LAMP stack on a Linux system, including Apache, PHP, and MySQL. It describes: 1) Installing Apache and testing the installation by accessing localhost in a web browser. 2) Installing PHP5 and restarting Apache so PHP works properly. 3) Testing the PHP installation by creating a test PHP file and viewing it in a browser. 4) Installing MySQL and setting the root password. It also describes installing phpMyAdmin for database administration.

Uploaded by

apeksha_bochare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Installing LAMP Stack on Linux

This document provides instructions to install the LAMP stack on a Linux system, including Apache, PHP, and MySQL. It describes: 1) Installing Apache and testing the installation by accessing localhost in a web browser. 2) Installing PHP5 and restarting Apache so PHP works properly. 3) Testing the PHP installation by creating a test PHP file and viewing it in a browser. 4) Installing MySQL and setting the root password. It also describes installing phpMyAdmin for database administration.

Uploaded by

apeksha_bochare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Installation of LAMP (LINUX,APACHE ,MYSQL & PHP)

@ Install Apache
To start off we will install Apache. STEP 1: Open up the Terminal (Applications > Accessories > Terminal). STEP 2: Copy/Paste the following line of code into Terminal and then press enter: sudo apt-get install apache2 STEP 3: The Terminal will then ask you for you're password, type it and then press enter.

Testing Apache
To make sure everything installed correctly we will now test Apache to ensure it is working properly. STEP 4: Open up any web browser and then enter the following into the web address: [Link] You should see a folder entitled apache2-default/. Open it and you will see a message saying "It works!" , congrats to you!

Install PHP
In this part we will install PHP 5. STEP 1 : Again open up the Terminal (Applications > Accessories > Terminal). STEP 2 : Copy/Paste the following line into Terminal and press enter: sudo apt-get install php5 libapache2-mod-php5 STEP 3: In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this: sudo /etc/init.d/apache2 restart

Test PHP
To ensure there are no issues with PHP let's give it a quick test run. STEP 1: In the terminal copy/paste the following line:

sudo gedit /var/www/[Link] This will open up a file called [Link]. STEP 2. Copy/Paste this line into the phptest file: <?php phpinfo(); ?> STEP 3. Save and close the file. STEP 4. Now open you're web browser and type the following into the web address: [Link] The page should look like this: Congrats you have now installed both Apache and PHP!

Install MySQL
To finish this guide up we will install MySQL. (Note - Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.) STEP 1: Once again open up the amazing Terminal and then copy/paste this line: sudo apt-get install mysql-server STEP 2: (optional). In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the [Link] file. gksudo gedit /etc/mysql/[Link] Change the line bind-address = [Link] And change the [Link] to your IP address. STEP 3 :This is where things may start to get tricky. Begin by typing the following intoTerminal: mysql -u root Following that copy/paste this line: mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); (Make sure to change yourpassword to a password of your choice.)

STEP 4 :We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal: sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled [Link]. To open it type the following:

Common questions

Powered by AI

Editing the php.ini file involves opening it in a text editor. This setup is necessary to ensure that PHP can interface correctly with MySQL, typically involving uncommenting or setting specific directives within the file such as 'extension=mysql.so' to enable MySQL extensions. However, the exact steps for editing php.ini were not detailed in the source document .

After installing Apache on a Linux system, the steps to test its installation include opening any web browser and typing 'http://localhost/' into the address bar. If the installation was successful, a page with a folder entitled 'apache2-default/' will appear, and upon opening it, a message stating 'It works!' will be shown .

To verify PHP is correctly installed and running, create a test PHP file by entering 'sudo gedit /var/www/testphp.php' in the Terminal. In the opened file, write '<?php phpinfo(); ?>', and save it. Open a web browser, navigate to 'http://localhost/testphp.php', and if installed correctly, the PHP information page will display .

For PHP and MySQL integration within the LAMP stack, additional software such as 'libapache2-mod-auth-mysql' and 'php5-mysql' is necessary. These packages enable PHP scripts to access and interact with a MySQL database efficiently .

The initial command to start the MySQL setup on a Linux system is to open the Terminal and execute 'sudo apt-get install mysql-server' .

The command 'SET PASSWORD FOR root@localhost' is important during the MySQL setup to initially define a password for the root user, enhancing security by preventing unauthorized database access .

To ensure PHP is compatible with Apache after installation, the Apache server must be restarted. This can be done by running the command 'sudo /etc/init.d/apache2 restart' in the Terminal .

To modify the bind address for MySQL to allow other network computers to access the server, you need to edit the 'my.cnf' file. This involves opening Terminal and using the command 'gksudo gedit /etc/mysql/my.cnf'. In the file, locate the line 'bind-address = 127.0.0.1' and change '127.0.0.1' to the server's actual IP address .

phpMyAdmin is a program installed during the LAMP setup to provide an easy-to-use tool for database management, allowing users to interact with MySQL through a graphical interface rather than command-line operations .

The document references providing further resources for those experiencing difficulties setting up MySQL, indicating that troubleshooting might involve consulting additional resources or guides to address specific issues beyond basic installation commands .

You might also like