编译安装Php5.5.19(腾讯云论坛版)

1)下载Php5.5.19
http://php.net/releases/

2)源码安装的步骤
1、解压软件源码包,并进入解压后的目录
2、./configure  预编译,也叫配置操作,源码安装的第一步,主要的作用是对即将安装的软件进行配置,比如安装路径、开启或关闭哪些功能
3、make  编译操作,生成makefile文件,正式安装时以此为依据进行安装
4、make install  正式安装


3)正式安装php
# groupadd www
# useradd -g www -s /sbin/nologin -M www
# yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel –y      
# tar zxvf php-5.5.19.tar.gz
# cd php-5.5.19
# ./configure –prefix=/usr/local/php –enable-inline-optimization –disable-debug –disable-rpath –enable-shared –enable-opcache –enable-fpm –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-gettext –enable-mbstring –with-iconv –with-mcrypt –with-mhash –with-openssl –enable-bcmath –enable-soap –with-libxml-dir –enable-pcntl –enable-shmop –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-sockets –with-curl –with-zlib –enable-zip –with-bz2 –with-readline
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
————预编译成功
# make
invertedregexiterator.inc
directorygraphiterator.inc
phar.inc
Build complete.
Don’t forget to run ‘make test’

————make无报错,成功。
# make install
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/php-5.5.19/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

————make installl无报错,安装成功。
# cp php.ini-development /usr/local/php/lib/php.ini
————默认的php.ini没有自动生成,需要手动设置
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
————以服务形式管理脚本。
# chmod +x /etc/init.d/php-fpm
# service php-fpm start
# /usr/local/php/bin/php -v
PHP 5.5.19 (cli) (built: Nov 30 2014 20:19:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

————查看php版本
# php -v
-bash: php: command not found
# export PATH=$PATH:/usr/local/php/bin
# php -v
PHP 5.5.19 (cli) (built: Nov 30 2014 20:19:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

PHP搭建成功~

发表评论

电子邮件地址不会被公开。 必填项已用*标注