PHP environment (php + Apache + mysql), apachemysql

Source: Internet
Author: User
Tags virtual environment yum repolist aliyun

PHP environment (php + Apache + mysql), apachemysql

I. software and system version

System:

Software Package: http://xiazai.jb51.net/201611/yuanma/php+apache+mysql (jb51.netw..rar

2. download the software package/change Source

(1) software tools required for download and Installation

Yum install-y wget vim unzip zip

 

(2) Source Change

1. First, uninstall the previously installed epel to avoid impact.

Rpm-e epel-release

2. Clear the yum Cache

Yum clean all

Yum makecache

3. rm-rf/etc/yum. repos. d .)

 

4. Download Alibaba Source

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

5,

Yum repolist

Iii. Install mysql

(1) Extract

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/mysqluseradd -s /sbin/nologin mysqlmkdir -p /data/mysqlchown -R mysql:mysql /data/mysql

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

Check whether the compilation is successful

Echo $?

(3) make mysql a service

cp support-files/my-large.cnf /etc/my.cnfcp support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqldvim /etc/init.d/mysqld

Modify file content
Basedir =/usr/local/mysql (mysql installation directory)
Datadir =/data/mysqlmysql database directory)

Chkconfig -- add mysqld

Chkconfig mysqld on

4. install Apache

(1) install the software running environment gcc

Yum install-y gcc

(2) Extract

Tar-jxvf httpd-2.2.27.tar.bz2

(3) Compile

./Configure -- prefix =/usr/local/apache2 -- enable-mod-shared = most -- enable-so

(4) Installation

Make

Make install

5. install PHP

(1) Extract

Tar-zxvf php-5.3.28.tar.gz

 

(2) install software plug-ins required by php

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


(3) Compile

Copy codeThe Code is 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-freetype-dir -- with-iconv-dir -- with-zlib-dir -- with-bz2 -- with-openssl -- with-mcrypt -- enable-soap -- enable-gd-native-ttf -- enable-mbstring -- enable -sockets -- enable-exif -- disable-ipv6

(4) Installation

Make

Make install

6. Edit the configuration file

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

<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all</Directory>

Changed:

<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all</Directory>

Find:

AddType application/x-gzip. gz. tgz

Add below this row:

AddType application/x-httpd-php. php

Find:

<IfModule dir_module> DirectoryIndex index.html</IfModule>

Change this row:

<IfModule dir_module> DirectoryIndex index.html index.htm index.php</IfModule>

Find:

# ServerName www.example.com: 80

To:

ServerName localhost: 80

2 test parsing php

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

Write:

<?phpphpinfo();?>

Open the browser: Address/1.php

This php environment has been installed
Note: 1. During installation, the system must be connected to the Internet. If the network cannot be connected, you can download the relevant rpm package for installation. (I directly import them using virtual machines as templates. If not, the previous method is optional in the virtual environment)
2. If apache is not a service, Apache will introduce it in the next article. In addition, there is no password after mysql is installed. You can set it yourself.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.