Lamp (linux+apache+mysql+php) environment construction

Source: Internet
Author: User

Lamp (linux+apache+mysql+php) environment construction

1 . installation apache2:sudo apt-get installapache2

after the installation is complete. Perform such as the following command to restart Apache:sudo/etc/init.d/apache2 restart, enter http://localhost or http://127.0.0.1 in the browser, and you will see "It works!" Description Apache installed successfully.

2 . Install PHP: sudoapt-get Install libapache2-mod-php5 php5 ;

Install extension php5-gd:sudo apt-get installlibapache2-mod-php5 php5-gd

Php5-mysql : sudo apt-get install libapache2-mod-php5 php5-mysql

Once installed, start Apache againand let it load the PHP module:sudo/etc/init.d/apache2 restart

Then create a new PHP file below the Web folder to test whether PHP is performing properly:

sudo gedit/var/www/phpinfo.php , enter and save and enter http://localhost/phpinfo.php in the browser, assuming that a page showing PHP execution parameters shows that PHP can execute normally.

<?php

Phpinfo ();

?php>
3. install MySQL:sudo apt-get installmysql-server mysql-client, at the end of the installation you need to enter rootpassword, The Rootpassword here refers to setting up MySQL's Rootpassword.

4 . To install Phpmyadmin-mysql database management:

sudo apt-get installlibapache2-mod-auth-mysql php5-mysql phpmyadmin . This installs the phpMyAdmin that is compatible with the PHP5. After installing phpMyAdmin. Configure phpMyAdmin and Apache2:

Cp/etc/phpmyadmin/apache.conf/etc/apache2/sites-available/phpmyadmin , Copy the apache.conf (Apache configuration file) from phpMyAdmin to the phpMyAdmin file under Apache2/sites-available and enter the sites-enabled directory:

cd/etc/apache2/sites-enabled , create a link to the configuration file: sudo ln-s. /sites-available/phpmyadmin, restart apache2:sudo/etc/init.d/apache2restart. Finally be able to open http://localhost/phpmyadmin verification.

This allows the basic components of lamp to be installed.

/********************************************************************************/

Next, make some other settings:

1.PHP The default settings for the network server root folder are: /var/www because of the security principles of the Linux system. The file read and write permission under the folder is only agreed to root user operation, so the root terminal command:sudo chmod 777/var/www changes the/var/www folder read and Write permissions, You can then write to the HTML or PHP file.

2. Configure APAHCE: Enable mod_rewrite module sudo a2enmod rewrite, restart Apacheserversudo/ Etc/init.d/apache2 Restart, create a new file under/var/www folder test.php, write code <?

PHP phpinfo ();? > Save and then enter http://127.0.0.1/test.php in the browser. Assuming that the PHP configuration information appears, the Lamp Apache is working (restart Apacheserver and test).

set Apache support. htm. html. php:sudo gedit/etc/apache2/apache2.conf

in the open file, add addtype application/x-httpd-php. php. htm. html we can.

Lamp (linux+apache+mysql+php) environment construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.