First, install MySQL:
for MySQL in the entire process is relatively independent installation, and my Ubuntu in the previous development has been installed MySQL, so the following is only the installation steps:
1, the installation of MySQL services:
sudo apt-get install Mysql-server
Note that you will be prompted to set the password for the MySQL root account during the installation process, and there is nothing else to be aware of.
2, install the MySQL client:
Direct Input Installation
3, the installation of MySQL Lib Dependent library:
sudo apt-get install Libmysqlclient15-dev
For installation.
Mysql.h will not be found in the system if it is not installed
4, some simple MySQL management:
To start the MySQL service:
Stop MySQL Service:
To modify the MySQL Administrator password:
sudo mysqladmin-u root password newpassword
Set up remote access (normally, the 3306 ports used by MySQL are simply listening on the IP 127.0.0.1 and denying access to other IP (viewable through netstat). Cancellation of local supervision
Listen to the need to modify the My.cnf file:):
sudo vi/etc/mysql/my.cnf
bind-address = 127.0.0.1//Find this content and comment
5, MySQL after the installation of the directory structure analysis (this structure only for the use of Apt-get install online installation):
Database storage directory:/var/lib/mysql/
Related configuration file storage directory:/usr/share/mysql
Related Commands Storage directory:/usr/bin (mysqladmin mysqldump, etc. command)
Starting footstep Storage directory:/etc/rc.d/init.d/
The above is the basic installation of MySQL.
Second, the installation of apache2:
1, official website download Http://httpd.apache.org/download.cgi,Unix source:httpd-2.2.24.tar.gz, I under the 2.2 24 version of the tar.gz, and then decompression tar.gz
Tar zxvf httpd-2.2.24.tar.gz
Move the extracted files to the/usr/src/apache2
sudo mv-r httpd-2.2.24/usr/src/apache2
Create one manually if no apache2 files cannot be moved
Because the file under the Modify/usr/requires root permission, you need to add the Sodu command and enter the password.
2, enter the/usr/src/apache2/httpd-2.2.24, and compile and install
cd/usr/src/apache2/httpd-2.2.24
./configure-prefix=/usr/local/apache-enable-module=so-enable-rewrite= shared-enable-authn-dbm
After the compilation is done, yes.
Enter the make command, and then enter: Make install start the installation.
3, after the installation is completed configuration httpd.conf:
Vim/usr/local/apache2/conf/httpd.conf #用编辑器打开httpd. conf, I'm using vim to open it.
Find #servername to remove the previous annotation symbol # and change the contents of the following to localhost:80 whole sentence:
ServerName localhost:80
This can be accessed through localhost when the service is started.
If you want to modify the server's listening port, you can look for listen 80 in httpd.conf to change the following 80 to the port you want, and then change the 80 servername localhost:80 back to the port you want.
4, start the service:
Cd/usr/local/apache2/bin #进入/usr/local/apache2/bin directory
sudo./apachectl Start #启动apache Service
Then open the browser, enter the access address localhost to see if it works, if it can be shown that the installation is complete.
Third, install the configuration PHP5
1, first install the LIBXML2 library, used to parse the XML Lib library input: sudo apt-get install Libxml2-dev to install
2, website download php http://www.php.net/downloads.php and then unzip the download to the tar.gz package
Tar zxvf php-5.4.15.tar.gz #解压
sudo mv-r php-5.4.15/usr/src/php5 #移动到/usr/src/php5 Directory
3. Compile and install PHP
cd/usr/src/php/php-5.4.15 #进入php所在目录
./configure
-prefix=/usr/local/php5 #php安装目录
- With-apxs2=/usr/local/apache2/bin/apxs #apxs所在的目录, if not on sudo find/-name apxs Query the directory
-with-mysql=/usr/ #这个是查找mysql. h directory, do not know why my mysql.h in/usr/include/but write this path does not have to write/usr/if you do not know where mysql.h sudo find/-name mysql.h look up
-with-mysqli=/usr/bin/mysql_config #mysql_config所在的目录, if you no longer find this directory.
-with-gd #打开对gd库的支持, if it should be for this error, install the GD library
-with-pear #打开pear命令的支持
-with-libxml-dir # Turn on support for the LIBXML2 that you just installed
The entire compilation statement is:
Copy Code code as follows:
./configure-prefix=/usr/local/php5-with-apxs2=/usr/local/apache2/bin/apxs-with-mysql=/usr/-with-mysqli=/usr/ Bin/mysql_config-with-gd-with-pear-with-libxml-dir
If there is error at compile-time is generally dependent on library lib problems, see the hint missing what dependent library, and then installed on the line.
Make it after you finish it and then enter made install for installation.
4. Manually specify PHP.ini files:
Open the/usr/local/apache2/conf/httpd.conf and add Phpinidir/etc/php.ini under LoadModule php_module modules/libphp5.so. Specify the path to the php.ini, and then enter the directory where you unzipped the php-5.4.15.tar.gz to copy the php.ini-development to the/etc of your assigned path and rename php.ini:
cd/usr/src/php/php-5.4.15 #进入php目录
sudo cp php.ini-development/etc #复制到/etc
sudo mv php.ini-development PHP.ini #重命名为php. ini
5, modify httpd.conf PHP support and default access index.php:
Open the/usr/local/apache2/conf/httpd.conf and change the contents of the <directory/> to:
<directory />
Options followsymlinks
directoryindex index.php index.html #指定默认先查找index. php If not, look for index.html
allowoverride None Order
Deny,allow deny out all
</Directory>
Then add the following line in AddType application/x-gzip gz. tgz:
AddType application/x-httpd-php. php
addtype application/x-httpd-php-source. Phps
Save the file after completion, if the hint file is read-only mode can not be saved, then it must be insufficient permissions when you open the httpd.conf command to add sudo
6, start \ Restart the Apache service, in the server root directory to write PHP files
Sudo/usr/local/apache2/bin/apachectl Stop #停止服务
sudo/usr/local/apache2/bin/apachectl start #启动服务
sudo/usr/ Local/apache2/bin/apachectl Rstart #重启服务
Cd/usr/lcoal/apache2/htdocs #进入apache2默认根目录
Create a index.php file in which to write <?php echo phpinfo ();? > then open the browser input localhost to see if you can display PHP information, and if so, configure it successfully.
Four, other configuration:
1. Manually configure Apache's default root directory
Open the/usr/local/apache2/conf/httpd.conf directory with the editor and find Documentroot/usr/lcoal/apache2/htdocs change the path to the path you want and find it down a bit < Directory "/usr/lcoal/apache2/htdocs" > Change the inside path to the path you want to specify.
2, view the path where PHP.ini is located:
often do not know where to look for the path of the specified php.ini, just write <?php echo phpinfo (); > file and then use the browser to access, see PHP all the information found after: Loaded Configuration file This line of the right path information is the address of the specified php.ini path.