<p>php-7.0.11编译安装<br/></p><p>1.下载php-7.0.11源码</p><p>http://php.net/downloads.php#v7.0.11</p><p>2.依赖开发包</p><pre class="brush:bash;toolbar:false">yuminstallgccgcc-c++libjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglibcglibc-develglib2glib2-develbzip2bzip2-develcurlcurl-developensslopenssl-devel</pre><p>3.编译安装</p><pre class="brush:bash;toolbar:false">$YOUR_PHP_SRC_DIR/configure--prefix=/usr/local/php-7.0.11--with-config-file-path=/usr/local/php-7.0.11/etc--enable-fpm--with-pdo-mysql=mysqlnd--enable-mysqlnd--with-mysqli=mysqlnd--with-openssl--with-mcrypt--with-gd--with-freetype-dir=/usr--with-jpeg-dir=/usr--with-png-dir=/usr--enable-exif--enable-mbstring--enable-pcntl--with-curl--enable-sockets--enable-soap--enable-ftp--with-zlib--enable-zip--with-bz2</pre><p>4.生产环境常用php编译配置</p><pre class="brush:bash;toolbar:false">./configure
--prefix=/u01/server/php-7.1.0
--with-config-file-path=/u01/server/php-7.1.0/etc
--enable-fpm
--disable-cgi
--with-fpm-user=daemon
--with-fpm-group=daemon
--enable-mbstring
--enable-soap
--enable-bcmath
--enable-ftp
--with-xmlrpc
--with-zlib
--with-bz2=/usr/local
--with-curl
--enable-exif
--with-openssl
--enable-calendar
--enable-ctype
--enable-pcntl
--enable-session
--enable-zip
--enable-sockets
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--with-sqlite3
--enable-phar
--with-iconv-dir=/u01/server/common
--with-gettext
--enable-intl
--with-icu-dir=/u01/server/common
--with-mcrypt=/u01/server/common
--with-gd
--with-png-dir=/u01/server/common
--with-jpeg-dir=/u01/server/common
--with-freetype-dir=/u01/server/common
--with-xpm-dir=/u01/server/common/libxpm-3.5.5</pre><p></p><p>phalcon编译安装</p><p>1.下载最新phalcon源码</p><pre class="brush:bash;toolbar:false">gitclonegit://github.com/phalcon/cphalcon.git</pre><p>2.编译安装</p><pre class="brush:bash;toolbar:false">cdcphalcon/build
./install</pre><p>3.加上配置(php.ini)</p><pre class="brush:bash;toolbar:false">extension=phalcon.so</pre><p>4.重启php-fpm</p><pre class="brush:bash;toolbar:false">servicephp-fpmrestart</pre><p></p><p>问题</p><p>1.GCC编译器报错(内存不够用)</p><pre class="brush:bash;toolbar:false">cc:internalcompilererror:Killed(programcc1)
Pleasesubmitafullbugreport,
withpreprocessedsourceifappropriate.
See<http://bugzilla.redhat.com/bugzilla>forinstructions.
make:***[phalcon.lo]Error1</pre><p></p><p>后记</p><p>1.使用phalcon文档里高级编译方法,编译之后的文件会很大,将近20几兆</p><p>2.使用phalcon文档里通用编译方法,编译之后文件只有5M左右</p><p>3.使用通用编译方法,命令自动搜索路径需要显示指定需要编译PHP版本php-config,phpize这2个命令的路径</p><p>4.cphalcon/build/install安装脚本会自动根据系统环境以及安装的PHP版本编译</p><p>5.编译的时间比较长>_<</p><p>6.编译时需要足够可用的内存>=2G</p><p>7.编译php时,官方建议使用mysqlnd驱动</p><p>8.解决phalcon高级编译可执行文件很大的问题</p><p>export CC="gcc"</p><p>export CFLAGS="-O2 -Wall -fvisibility=hidden -flto -DZEPHIR_RELEASE=1"</p><p>9.使用php自带的gd库时,需要带上--with-bz2,可能依赖这个库</p>