Php+mysql Environment Building in Ubuntu

Source: Internet
Author: User
Tags install php aliyun

PHP Environment installation (APACHE2 installation)

1. Install Apache, install command: sudo apt-get install apache2

2. Environment configuration:

1) configuration file: Path is/etc/apache2, configuration file is apache2.conf, and there is no http.conf.

2) Default Web site root directory:/var/www/html, use the browser to access the http://localhost can be opened;

3) Modify the Web site root directory:

A, "sudo vim/etc/apache2/apache2.conf"--Find the location of "" and Change "/var/www/" to the new root "/home/www"

B, "sudo vi/etc/apache2/sites-available/000-default.conf"-Find the location of "documentroot/var/www/html" and Change "/var/www /html "/home/www" for the new root directory.

4) Restart Apache server: sudo/etc/init.d/apache2 restart

PHP Configuration

1, update the source list, or install PHP will fail:

Command Line input: vim/etc/apt/source.list

Add the following to the front:

Deb Http://mirrors.aliyun.com/ubuntu/precise main Restricteduniverse Multiverse

Deb Http://mirrors.aliyun.com/ubuntu/precise-security mainrestricted Universe Multiverse

Deb Http://mirrors.aliyun.com/ubuntu/precise-updates mainrestricted Universe Multiverse

Deb http://mirrors.aliyun.com/ubuntu/precise-proposed mainrestricted Universe Multiverse

Deb Http://mirrors.aliyun.com/ubuntu/precise-backports mainrestricted Universe Multiverse

DEB-SRC http://mirrors.aliyun.com/ubuntu/precise mainrestricted Universe Multiverse

DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-securitymain Restricted Universe multiverse

DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-updatesmain Restricted Universe multiverse

DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-proposedmain Restricted Universe multiverse

DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-backportsmain Restricted Universe multiverse

Apt-get Update//Updates the list

2. Install PHP, install the command: Sudoapt-get install PHP5

3, let Apache support PHP, installation command: sudo apt-get install LIBAPACHE2-MOD-PHP5

4, install PHP5-GD module, installation command: Sudoapt-get install PHP5-GD

5. Let PHP support Curl

  1) first check to see if Php5-curl is installed: dpkg-l | grep ' Php5-curl '
  2) if not installed, then: Apt-get install Php5-curl

3) Ensure that Extension_dir exists and contains curl.so,

  Find Extension_dir:php-i | grep Extension_dir

4) To ensure the existence of/etc/php5/mods-available/curl.ini, the file contents are as follows:

; Configuration for PHP CURL module
; Priority=20
Extension=curl.so

3. MySQL Installation

sudo apt-get install mysql-client-5.5

sudo apt-get install mysql-server-5.5

sudo apt-get install Php5-mysql (associate apache2 with MySQL)

/etc/init.d/mysql start MySQL Service

/etc/init.d/mysql stop to shut down the MySQL service

/etc/init.d/mysql Restart restart MySQL Service

Php+mysql Environment Building in Ubuntu

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.