PHP Environment Build (php+apache+mysql) _php Example

Source: Internet
Author: User
Tags bz2 install php openssl virtual environment yum repolist aliyun

Software and system version

System Download Address:

Package Download Address: Http://xiazai.jb51.net/201611/yuanma/php+apache+mysql (jb51.net). rar

Second, download the package/feed

(1) Download the installation needs software package tool

Yum install-y wget vim unzip zip


(2) Exchange source

1. First uninstall the Epel before loading to avoid the impact

Rpm-e Epel-release

2, empty Yum cache

Yum Clean All

Yum Makecache

3, rm-rf/etc/yum.repos.d/* (when performing this operation remember to install the wget otherwise you have to mount the CD-ROM wget. )


4, download Ali

Wget-p/etc/yum.repos.d/http://mirrors.aliyun.com/repo/epel-6.repohttp://mirrors.aliyun.com/repo/centos-6.repo

5,

Yum Repolist

Third, the installation of MySQL

(1) Decompression

TAR-ZXVF mysql-5.1.72-linux-x86_64-glibc23.tar.gz

(2) Configure MySQL

MV Mysql-5.1.72-linux-x86_64-glibc23/usr/local/mysql 
cd/usr/local/mysql
useradd-s/sbin/nologin MySQL
mkdir-p/data/mysql
chown-r mysql:mysql/data/mysql

./scripts/mysql_install_db--user=mysql--datadir=/data/mysql

Check if compilation succeeded

echo $?

(3) Make MySQL service

CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
CP support-files/mysql.server/etc/init.d/mysqld
chmod 755/etc/ Init.d/mysqld
Vim/etc/init.d/mysqld

Modify the contents of a file
Basedir=/usr/local/mysql (MySQL installation directory)
Datadir=/data/mysqlmysql database directory)

Chkconfig--add mysqld

Chkconfig mysqld on

Four, install Apache

(1) Installation software Operation Environment GCC

Yum install-y gcc

(2) Decompression

TAR-JXVF httpd-2.2.27.tar.bz2

(3) Compiling

./configure--prefix=/usr/local/apache2--enable-mods-shared=most--enable-so

(4) Installation

Make

Make install

V. Installation of PHP

(1) Decompression

TAR-ZXVF php-5.3.28.tar.gz


(2) Install PHP required software plugin

Yum install-y libxml2-devel.x86_64
yum install-y
openssl-devel.x86_64 yum install-y bzip2-devel.x86_64 Yum install-y libjpeg-turbo-devel.x86_64
yum install-y libpng-devel.x86_64 yum install-y freetype-devel.x86_
Yum install-y libmcrypt-devel.x86_64


(3) Compiling

Copy Code code as follows:
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Php/etc--with-mysql=/usr/local/mysql--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir --with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap-- Enable-mbstring--enable-sockets--enable-exif--disable-ipv6

(4) Installation

Make

Make install

Vi. Editing a configuration file

(1) vim/usr/local/apache2/conf/httpd.conf found:

<directory/>
 Options followsymlinks
 allowoverride None order
 deny,allow
 deny
from all </Directory>

To

<directory/>
 Options followsymlinks
 allowoverride None order
 Deny,allow
 allow to all
</Directory>

Found it:

AddType application/x-gzip. GZ tgz

Add below the line:

AddType application/x-httpd-php. php

Found it:

<ifmodule dir_module>
 directoryindex index.html
</IfModule>

Change the line to:

<ifmodule dir_module>
 directoryindex index.html index.htm index.php
</IfModule>

Found it:

#ServerName www.example.com:80

Modified to:

ServerName localhost:80

2 Test parsing PHP

vim/usr/local/apache2/htdocs/1.php

Write:

<?php
phpinfo ();
? >

Browser Open: Address/1.php

Since the installation of the PHP environment is complete
Note: 1. During installation, the system should be networked, if the network can not be connected, download the relevant RPM package for installation. (I myself are directly imported through a virtual machine template, unless the virtual environment is optional before the method)
2.apache did not make services, Apache services will be introduced in the next, and MySQL installed after the completion of the password, you can set up.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.