• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

CentOS 6部署PHP开发环境

php 搞代码 3年前 (2022-01-23) 21次浏览 已收录 0个评论

适用环境:

CentOS 6.5 32bit

Linux + Nginx + Mysql + PHP

版本与时间:(截至此帖发帖日期2014-10-14,所有版本皆为最新版本)

Nginx-1.7.6

Mysql-5.6.21

PHP-5.6.1

一、下载:

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

mysql:http://dev.mysql.com/downloads/mysql/ (选择Linux – Generic版本的Linux – Generic (glibc 2.5) (x86, 32-bit), Compressed

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

二、安装(忽略解压过程,安装完后默认路径在/usr/local/xxx):

Nginx

1. 安装依赖包:# yum -y install pcre-devel zlib-devel

2. 配置安装:

# ./configure

# make && make install

3. 建立软链接:# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/

4. 进入/usr/local/nginx/conf目录,建立虚拟主机配置目录,并将此目录导入到nginx.conf中

# mkdir vhost

# vim ./nginx.conf (在最后大括号前添加一行并保存退出: include vhost/*.conf; )

5. 可在vhost目录内新建虚拟主机配置文件,以.conf结尾,内容可参考nginx.conf中的server部分

MySql

1. 直接将解压后的目录移至/usr/local/mysql

2. 进入/usr/local/mysql目录,执行以下一系列命令(来源于Mysql官网文档:http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html):

3. 配置my.cnf

a. # vim /etc/my.cnf

b. 修改几项(在[mysqld]下):

datadir=/usr/local/mysql/data

socket=/tmp/mysql.sock

character-set-server=utf8

collation-server=utf8_general_ci

c.保存退出,并重启mysql

php

1. 安装依赖包:# yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libmcrypt-devel

2. 建立软链接(解决PHP5.6编译时报Don’t know how to define struct flock on this system, set –enable-opcache=no的错误):

# 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. 配置:

# ./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 –with-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 –with-ldap –with-ldap-)本文来(源gaodai#ma#com搞@@代~&码*网2

搞代gaodaima码

sasl –with-xmlrpc –enable-zip –enable-soap –without-pear –with-zlib –enable-pdo –with-pdo-mysql

4. 编译安装(在上一步配置过程中无报错的情况下才开始此步骤):

# make && make install


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:CentOS 6部署PHP开发环境

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址