温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

PHP -- 编译安装

发布时间:2020-02-24 17:32:24 来源:网络 阅读:603 作者:Ohimma 栏目:web开发

小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/mysql
mysql安装目录,对mysql的支持 
--with-mysqli=/usr/local/mysql/bin/mysql_config            
mysqli扩展技术不仅可以调用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-pcntl                     freeTDS需要用到的,可能是链接mssql 才用
mhash和mcrypt算法的扩展
--with-mcrypt                     算法 
--with-mhash                      算
以上函数库需要安装
--with-gmp  应该是支持一种规范 
--enable-inline-optimization  优化线程
--with-openssl                     openssl的支持,加密传输时用到的 
--enable-dbase                     建立DBA 作为共享模块
--with-pcre-dir=/usr/local/bin/pcre-config      perl的正则库案安装位置 
--disable-dmalloc
--with-gdbm                     dba的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

 chkconfig  php-fpm  on

/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 即可


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI