Create a PHP server in Ubuntu (Apache + PHP + MySQL)

Source: Internet
Author: User
Tags php server
From: http://apps.hi.baidu.com/share/detail/37687288

Ubuntu (Apache + PHP + MySQL) + phpMyAdmin
Create Apache + PHP + MySql in Ubuntu
Basic Support Environment. Zend optimization is not applied yet, so Zend optimizer installation is not involved here. In fact, installation in Ubuntu is far easier than setting in windows, and setting in a terminal is easier.
1. Install the apache service
Sudo apt-Get install apache2
Then, follow the prompts to install apahce. It can be opened here

Http: // 127.0.0.1

It works
2. Install PhP5
Sudo apt-Get install PhP5
Sudo apt-Get install libapache2-mod-php5
Sudo/etc/init. d/apache2 restart
After OK, let's see if it takes effect.
Gksudo gedit/var/www/testphp. php
Inbound Probe
Save run

Http: // 127.0.0.1/testphp. php

3. Install MySQL
Sudo apt-Get install mysql-Server
After installation is complete, follow the prompts to set the root password
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
Now The apache2 + PhP 5.2.4.2 + mysql5.0.51 environment is complete.
========================================================== ======================
Ubuntu (Apache + PHP + MySQL) + phpMyAdmin
After successfully installing Ubuntu 8.04.1 from the hard disk, I have been trying to build a web server in the Ubuntu 8.04.1 environment, lamp (liunx + Apache + MySQL + PHP) + phpMyAdmin naturally became my first glare. In the end, I found the most detailed and comprehensive method for installing and configuring the lamp web server on the Ubuntu Chinese wiki:
1. Installation
1. Install Lamp
Select edit in the new software package manager -- mark the software package with the Task Group
In the displayed window, select lamp server and click OK.
Click the green check mark application button in the main window.
Okay. Wait... Wait until the new version is automatically downloaded and installed.
A prompt will be displayed in the middle to enter the password of the root user of MySQL.
You can also run the following command to install the SDK in Terminal Mode:
Sudo apt-Get install apache2 libapache2-mod-php5 PhP5 php5-gd mysql-server php5-mysql phpMyAdmin
2. Install phpMyAdmin
Run commands in the terminal
Sudo apt-Get install phpMyAdmin
Ii. Configuration
1> Apache configuration file path/etc/apache2/apache2.conf
2> PHP. ini path/etc/PhP5/apache2/php5.ini
3> MySQL configuration file path/etc/MySQL/My. CNF
4> phpMyAdmin configuration file path/etc/PHPmyAdmin/Apache. conf
5> website root directory/var/WWW
1. Configure Apache
Use commands in the terminal
Sudo gedit/etc/apache2/apache2.conf
Add the following lines at the end of the configuration file:
Support for adding file types
Addtype application/X-httpd-PHP. php. htm. html
Default Character Set Based on your needs
Adddefacharcharset UTF-8
Server address
Servername 127.0.0.1
The order of adding the three homepage files can be changed to the previous access priority (of course, you can also add other settings such as default. php)
Directoryindex index.htm index.html index. php
2. Configure PhP5
There is nothing to say about it, depending on your own needs.
The following is the default time zone
; Default. timezone = remove the semicolon and add a PRC. Indicates the People's Republic of China (GMT + 8 time zone)
Default. timezone = PRC
3. Configure MySQL
Sudo gedit/etc/MySQL/My. CNF
Note that
By default, only local access to the database is allowed.
Bind-address 127.0.0.1 restricts local access to MySQL. If you need access from other machines, use # To comment out this sentence.
# Bind-address 127.0.0.1
4. Configure phpMyAdmin
PhpMyAdmin is not installed under/var/WWW by default, but in/usr/share/phpMyAdmin
You can copy phpMyAdmin or someone on the internet says that you can create a link and copy the Link (not tried)
Then run the command in the terminal
Sudo gedit/etc/PHPmyAdmin/Apache. conf
Then, change the path of the following two sentences to/var/www/phpMyAdmin.
Alias/PHPmyAdmin/usr/share/phpMyAdmin
Changed:
Alias/PHPmyAdmin/var/www/phpMyAdmin
Operator: Common commands
1. Restart Apache
Sudo/etc/init. d/apache2 restart
2. Restart MySQL
Sudo/etc/init. d/MySQL restart
Now that the lamp environment is successfully configured, try echo phpinfo!
Lamp is not that mysterious! Except for the download time, the entire configuration process will never take you five minutes.
GD library Installation
Sudo apt-Get install php5-gd
Remember to restart Apache after installation
Sudo/etc/init. d/apache2 restart
Enable mod_rewrite module
Sudo a2enmod rewrite

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.