编译安装Php5.5.19

发布时间:2017-06-27 13:05:18

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

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搭建成功


注:此方法不限于腾讯云服务器,百度云服开放云务器,阿里云服务器,传统服务器也适用!
 
北京凯铧互联科技有限公司(简称凯铧互联)由多名前阿里云资深技术专家创立,核心员工来自阿里巴巴、腾讯等,做为一家综合性方案商,凯铧互联向各行业用户提供基于公有云,私有云,混合云等基于云计算的各种解决方案。