CenterOS6.5(Minimal) 搭建php

来源:互联网 发布:js数组与字符串比较 编辑:程序博客网 时间:2024/05/21 06:35

安装基础库请看这里

PHP(5.5.14)

安装libmcrypt

  1. wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz -P /usr/local/app/sources/

  2. cd /usr/local/app/sources/

  3. tar -xf libmcrypt-2.5.7.tar.gz

  4. cd libmcrypt-2.5.7

  5. ./configure

  6. make && make install

php官网下载地址(http://php.net/releases/)

  1. wget http://125.39.35.145/files/7192000006ABB044/sg2.php.net/distributions/php-5.5.14.tar.gz -P /usr/local/app/sources/

  2. cd /usr/local/app/sources/

  3. tar -xf php-5.5.14.tar.gz

  4. 编辑 vi /etc/ld.so.conf 加入/usr/local/lib

  5. 增加 /usr/local/lib

  6. ldconfig

  7. cd php-5.5.14

  8. ./configure --prefix=/usr/local/app/php --enable-fpm --with-iconv-dir --with-libxml-dir --enable-xml --with-gd --with-openssl --with-xmlrpc --enable-soap --enable-mbstring --enable-mbregex --with-mysql --with-mysqli --enable-pdo --with-zlib --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --with-mhash --with-mcrypt --enable-zip --with-pcre-regex --disable-fileinfo

  9. make && make install clean

修改配置文件

  1. cp php.ini-development /usr/local/app/php/lib/php.ini

  2. cp /usr/local/app/php/etc/php-fpm.conf.default /usr/local/app/php/etc/php-fpm.conf

  3. 修改php扩展目录 vi /usr/local/app/php/lib/php.ini增加一行 extension_dir = "/usr/local/app/php/lib/php/extensions/no-debug-non-zts-20121212"

  4. 修改php启动的用户和组 vi /usr/local/app/php/etc/php-fpm.conf修改user和group分别为www(否则nginx修改root后将没有权限访问php文件)

  5. 启动php /usr/local/app/php/sbin/php-fpm -y /usr/local/app/php/etc/php-fpm.conf -c /usr/local/app/php/lib/php.ini

  6. 启动nginx /usr/local/app/nginx/sbin/nginx -c /usr/local/app/nginx/conf/nginx.conf

  7. 启动php-fpm /usr/local/app/php/sbin/php-fpm -y /usr/local/app/php/etc/php-fpm.conf -c /usr/local/app/php/lib/php.ini

  8. 打开浏览器输入 http://ipaddr/index.php 测试

0 0
原创粉丝点击