Install and configure apache2 + php5 + mysql5 in ubuntu

Source: Internet
Author: User
Install 1. Install mysql database: sudoapt-getinstallmysql-server2, installation ApacheHTTPServersudoapt-getinstallapache23, installation PHP5 and ApachePHP5modulesudoapt-getinstallphp5libapache2-mod-php54, installation php5-mysqlsudoapt-getinstallphp5

Install 1. Install mysql database: sudo apt-get install mysql-server 2, install Apache HTTP Server sudo apt-get install apache2 3, install PHP5 and Apache PHP5 module sudo apt-get install php5 libapache2-mod-php5 4, install php5-mysql sudo apt-get install php5

Install

1. Install the mysql database:

Sudo apt-get install mysql-server

2. install Apache HTTP Server

Sudo apt-get install apache2


3. Install PHP5 and Apache PHP5 modules
Sudo apt-get install php5 libapache2-mod-php5

4. Install php5-mysql
Sudo apt-get install php5-mysql

5. Install phpMyAdmin
Sudo apt-get install phpmyadmin


Configuration

1. Configure php5 to allow mysql and gd modules

Sudo vim/etc/php5/apache2/php. ini

Add:
Extension = mysql. so
Extension = gd. so

2. Configure apache2
2.1) set the default encoding: sudo vim/etc/apache2/conf-available/charset. conf
# Adddefadefacharset UTF-8 before the # Remove, use UTF-8 encoding, of course, you can also change the UTF-8 to other encoding.
2.2) change the path pointed to by DocumentRoot

Sudo vim/etc/apache2/sites-available/000-default.conf

And

Sudo vim/etc/apache2/sites-available/default-ssl.conf

Change The apache2 running path and the path directed by DocumentRoot (absolute path)

Test to check the PHP installation status:
Sudo vim/usr/workspace/index. php
Insert the following line of code in the above file (Path: configured apache2 running path:
 

Restart Apache2: sudo/etc/init. d/apache2 restart

View this page in a Web browser by using http: // localhost/index. php or http: // yourserveripaddress/testphp. php address.



The following is the version information of my installation.


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.