Deploy the PHP development environment in CentOS6

Source: Internet
Author: User
Tags php development environment
Use CentOS6 to deploy the PHP development environment:

CentOS 6.5 32bit

Linux + Nginx + Mysql + PHP


Version and time: (as of the posting date of this post, all versions are the latest version)

Nginx-1.7.6

Mysql-5.6.21

PHP-5.6.1


1. download:

Nginx: http://nginx.org/en/download.html

Mysql: http://dev.mysql.com/downloads/mysql/ (select Linux-Generic versionLinux-Generic (glibc 2.5) (x86, 32-bit), Compressed)

Php: http://php.net/downloads.php#v5.6.1



II. Installation (ignore the decompression process. after installation, the default path is/usr/local/xxx ):

<1> Nginx

1. install the dependency package: # yum-y install pcre-devel zlib-devel

2. configure and install:

#./Configure

# Make & make install

3. create a soft link: # ln-s/usr/local/nginx/sbin/nginx/usr/local/bin/

4. enter the/usr/local/nginx/conf Directory, create a virtual host configuration directory, and import the directory to nginx. conf.

# Mkdir vhost

# Vim./nginx. conf (add a line before the last braces and save and exit: include vhost/*. conf ;)

5. You can create a VM configuration file in the vhost Directory, ending with. conf. For more information, see the server section in nginx. conf.


<2> MySql

1. directly move the extracted directory to/usr/local/mysql

2. go to the/usr/local/mysql directory and execute the following commands (from the Mysql official website documentation: http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html ):


3. configure my. cnf

A. # vim/etc/my. cnf

B. modify several items (under [mysqld ):

Datadir =/usr/local/mysql/data

Socket =/tmp/mysql. sock

Character-set-server = utf8

Collation-server = utf8_general_ci

C. save and exit, and restart mysql


<3> php

1. install the dependency package: # yum-y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libmcrypt-devel

2. create a soft link (solve the problem of Don't know how to define struct flock on this system, set -- enable-opcache = no when PHP5.6 is compiled ):

# Sudo ln-s/usr/local/mysql/lib/libmysqlclient. so/usr/lib/
# Sudo ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18

3. configuration:

#. /Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-mysql =/usr/local/mysql -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-iconv-dir =/usr/local -- with-freetype-dir -- with-jpeg-dir --- png-dir -- with-zlib -- with-libxml-dir =/usr -- enable-xml -- disable-rpath -- enable-discard-path -- enable-safe-mode -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl -- with-curlwrappers -- enable-mbregex -- enable-fastcgi -- enable-fpm -- enable-force-cgi -redirect -- enable-mbstring -- with-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash -- enable-pcntl -- enable-sockets -- -ldap -- with-ldap-sasl -- with-xmlrpc -- enable-zip -- enable-soap -- without-pear -- with-zlib -- enable-pdo -- with-pdo-mysql

4. Compile and install (this step starts only when no error is reported during the configuration process in the previous step ):

# Make & make install

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.