PHP -- 编译安装
小Q:今天重新用最新版本搭建了lnmp架构,正好整合一下我博客的模块;
1、编译参数详解和编译参数安装;
2、拷贝配置文件;
3、出的错误;
--------------------------------------------------------------------------------------------------------
1、编译参数详解和编译参数安装;
因为是源码安装,下载解压就不说了,直接说重点;
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --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-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-mysql
--with-mysqli=/usr/bin/mysql_config
make && make install
--prefix=/usr/local/php指定php安装目录--with-apxs2=/usr/local/apache/bin/apxs整合apache,apxs功能是使用mod_so中的LoadModule指令,加载指定模块到apache,要求apache要打开SO模块--with-config-file-path=/usr/local/php/etc指定php.ini位置--with-MySQL=/usr/local/mysqlmysql安装目录,对mysql的支持--with-mysqli=/usr/local/mysql/bin/mysql_configmysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。--enable-safe-mode打开安全模式--enable-ftp打开ftp的支持--enable-zip打开对zip的支持--with-bz2打开对bz2文件的支持--with-jpeg-dir打开对jpeg图片的支持--with-png-dir打开对png图片的支持--with-freetype-dir打开对freetype字体库的支持--without-iconv关闭iconv函数,种字符集间的转换--with-libXML-dir打开libxml2库的支持--with-XMLrpc打开xml-rpc的c语言--with-zlib-dir打开zlib库的支持--with-gd打开gd库的支持--enable-gd-native-ttf支持TrueType字符串函数库--with-curl打开curl浏览工具的支持--with-curlwrappers运用curl工具打开url流--with-ttf打开freetype1.*的支持,可以不加了--with-xsl打开XSLT文件支持,扩展了libXM2库,需要libxslt软件--with-gettext打开gnu的gettext支持,编码库用到--with-pear打开pear命令的支持,PHP扩展用的--enable-calendar打开日历扩展功能--enable-mbstring多字节,字符串的支持--enable-bcmath打开图片大小调整,用到zabbix监控的时候用到了这个模块--enable-sockets打开sockets支持--enable-exif图片的元数据支持--enable-magic-quotes魔术引用的支持--disable-rpath关闭额外的运行库文件--disable-debug关闭调试模式--with-mime-magic=/usr/share/file/magic.mime魔术头文件位置CGI方式安装才用的参数--enable-fpm打上PHP-fpm补丁后才有这个参数,CGI方式安装的启动程序--enable-fastCGI支持fastcgi方式启动PHP--enable-force-CGI-redirect重定向方式启动PHP--with-ncurses支持ncurses屏幕绘制以及基于文本终端的图形互动功能的动态库--enable-pcntlfreeTDS需要用到的,可能是链接mssql才用mhash和mcrypt算法的扩展--with-mcrypt算法--with-mhash算以上函数库需要安装--with-gmp应该是支持一种规范--enable-inline-optimization优化线程--with-opensslopenssl的支持,加密传输时用到的--enable-dbase建立DBA作为共享模块--with-pcre-dir=/usr/local/bin/pcre-configperl的正则库案安装位置--disable-dmalloc--with-gdbmdba的gdbm支持--enable-sigchild--enable-sysvsem--enable-sysvshm--enable-zend-multibyte支持zend的多--with-openssl,需要openssl库。
2、配置文件
cp php.ini-production /usr/local/php/etc/php-ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfigphp-fpmon
/usr/local/php/sbin/php-fpm -t
/etc/init.d/php-fpm start
3、错误简解
a. error: wrong mysql library version or lib not found. Check config.log for more information.
解决:将上边标红的编译参数去掉,之后活动编译该模块 --with-mysqli=/usr/bin/mysql_config
b. ERROR: [pool www] cannot get uid for user 'php-fpm'
解决:useradd -s /sbin/nologin php-fpm
c. /lib64/liblber-2.4.so.2: could not read symbols: Invalid operation
解决:进入Makefile 文件,找到开头为 EXTRA_LIBS=,在最后边加上-llber 即可
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。