Install ubuntu + apache2 + php5 + mysql5.0

Source: Internet
Author: User
Although ubuntu installation lamp is very simple, but still a lot of friends installed is not successful, take a look at the installation steps to write a look at & nbsp; installation steps 1. InstallSSHClientandServer (formyremoteaccess) sudoapt-getinstallssh2.InstallDatabaseServer (Rumor now only

Although installing lamp in ubuntu is very simple, many friends may fail to install it. let's take a look at the installation steps.

 

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 the mysql and gd modules to check whether the file finally contains the following code, 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 your PHP Installation 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 browser through http: // yourserveripaddress/testphp. php or http: // localhost/testphp. php address. SupplementRun, 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

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.