Install Ubuntu + apache2 + PhP5 + mysql5.0

Source: Internet
Author: User

Installation Steps

1. Install SSH client and server (for my remote access)

Sudo apt-Get Install SSH

2. Install Database Server (it is rumored that only version 5.0 can be installed. I have never practiced anything else)

Sudo apt-Get install mysql-server-5.0

3. install Apache HTTP Server

Sudo apt-Get install apache2

4. Install PhP5 and Apache PhP5 Module

Sudo apt-Get install PhP5 libapache2-mod-php5

5. Install php5-mysql

Sudo apt-Get install php5-mysql

6. Restart Apache

Sudo/etc/init. d/apache2 restart

7. Optionally, install phpMyAdmin
Sudo apt-Get install phpMyAdmin

Note: If you want to run the PHP script, you have to install the php5-cli

Sudo apt-Get install php5-cli (this was found online, but some people didn't mention it .)

Configuration

1. Configure PhP5

Sudo gedit/etc/PhP5/apache2/PHP. ini

Allow MySQL and Gd modules to check whether the file contains the followingCode, If not added. (It is added at the end of the configuration file by default. Check it just in case)
Extension = mysql. So
Extension = Gd. So

2. Configure apache2

Sudo gedit/etc/apache2/CONF. d/charset
This is the website encoding configuration, the content inside is very little, open to see it will know, I here will be the last line of # adddefaultcharset UTF-8 in front of # Remove, use UTF-8 encoding, of course you can also change the UTF-8 into another code.

Sudo gedit/etc/apache2/sites-available/Default

Change The apache2 running path, change the path (absolute path) pointed to by DocumentRoot, and change the path in <directory> to be consistent with that of DocumentRoot.

3. Configure MySQL to support access from other clients. You do not need to modify it if you do not need it.
Sudo gedit/etc/MySQL/My. CNF

Search for files
Skip-networking
Change
# Skip-networking
Save and close the file.

Restart MySQL
Sudo/etc/init. d/MySQL restart

Test

To check your

To check yourPHPInstallation status: Sudo gedit/var/www/testPHP.PHP Insert the following line of code into the above file: <?PHP PHPInfo ();?> View this page in a Web browserHttp: // yourserveripaddress/TestPHP.PHPOrHttp: // localhost/TestPHP.PHP Address. Supplement Run, stop, and restart Apache
Run Apache with the following command:
Sudo/usr/sbin/apache2ctl start

To stop Apache, use:
Sudo/usr/sbin/apache2ctl stop

Restart Apache and run the following command:
Sudo/usr/sbin/apache2ctl restart

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.