Ubuntu lamp (apache + mysql + php) Environment setup and Related Extension updates

Source: Internet
Author: User

I. Environment Installation
1. Install apache2
Sudo apt-get install apache2
After installation, open http: // localhost/or http: // 127.0.0.1 in the browser.
If It works appears! Verify that apache is successfully installed.
2. install PHP
Sudo apt-get install php5
Sudo apt-get install libapache2-mod-php5
Sudo/etc/init. d/apache2 restart
Test:
Sudo vi/var/www/testphp. php
Write to php works! Save and exit vi.
Enter http: // 127.0.0.1/testphp. php or http: // localhost/testphp. php in the browser.
If php works is displayed! Indicates that the php configuration is successful.
3. Install MYSQL
Sudo apt-get install mysql-server
Set the root password as prompted during installation.
Note: change the password:
Mysql-uroot-p
Mysql> use mysql;
Mysql> update user set password = PASSWORD ('new password') WHERE user = 'root ';
Mysql> exit
Restart mysql or refresh permissions.
Restart: sudo/etc/init. d/mysql restart or restart mysql
4. Make apache and php support mysql
Sudo apt-get install libapache2-mod-auth-mysql
Sudo apt-get install php5-mysql
Sudo/etc/init. d/apache2 restart
So far, Ubuntu + apache2 + php 5 + mysql has been installed.
Tip:
/Etc/apache2:
1. apache2.conf is the main configuration file and the httpd. conf user configuration file.
2. The virtual directory is in httpd. conf.
DocumentRoot "path"
ServerName
# Listen 127.0.0.1: 80 # note that you cannot write a listener in this file. If you must write a listener, you must first include/etc/apache2/ports in apache2.conf. conf to comment out, because ports. port 80 has been monitored in conf
3. You can set the virtual host in/etc/apache2/sites-enabled/000-default.
4. php. ini:/etc/php5/apache2/php. ini
5. mysql. cnf:/etc/mysql/my. cnf
4. restart apache:/etc/init. d/apache2 restart
5. restart mysql: sudo/etc/init. d/mysql restart or restart mysql
6. log File:/var/log/apache2/
Ii. GD library Installation
Sudo apt-get install php5-gd
Sudo/etc/init. d/apache2 restart
Iii. curl extension Installation
Sudo apt-get install php5-curl
Sudo/etc/init. d/apache2 restart

Related Article

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.