PHP5.5编译参数总结
可从http://php.net/get/php-5.5.38.tar.gz/from/a/mirror中的镜像选择一个下载tar.gz bz2等格式的源码包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ./configure \ --prefix=/application/php-5.5.38 \ --with-mysql=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local/libiconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-mcrypt \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-ip \ --enable-sockets \ --with-xmlrpc \ --enable-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-ftp \ --enable-opcache=no \ ##--enable-fpm \ ##--with-apxs2=/usr/local/apache/bin/apxs |
./configure \
–prefix=/application/php-5.5.38 \ 设置prefix路径,安装后所移动到的位置
–with-mysql=/application/mysql \ mysql连接程序 若没有mysql 则–with-mysql=mysqlnd
–with-pdo-mysql=mysqlnd \
–with-iconv-dir=/usr/local/libiconv \ iconv库
–with-freetype-dir \ 添加freetype 支持
–with-jpeg-dir \ 添加打开jpg图片的支持
–with-png-dir \ 添加打开jpg图片支持
–with-zlib \ 添加zlib支持,用于压缩
–with-libxml-dir=/usr \ 打开libxml2库的支持
–enable-xml \
–disable-rpath \ 关闭额外关闭额外的运行库文件
–enable-bcmath \ 打开图片大小调整,用zabbix监控时会用到该模块
–enable-shmop \
–enable-sysvsem \ 使用sysv信号机制,则打开此选项
–enable-inline-optimization \ 优化线程
–with-curl \ 增加curl库支持,用于打开url地址
–enable-mbregex \
–enable-fpm \ 表示激活PHP-FPM方式服务,即FactCGI方式运行PHP服务
–with-apxs2=/usr/local/apache/bin/apxs 用于阿帕奇httpd配合
–enable-mbstring \ 支持mbstring
–with-mcrypt \ 编码库支持
–with-gd \ gd库支持
–enable-gd-native-ttf \ 支持TrueType字符串函数库
–with-openssl \ openssl支持用于加密传输
–with-mhash \ mhash算法的扩展
–enable-pcntl \ freeTDS需要用到,可能是链接mssql
–enable-zip \ 打开对zip的支持
–enable-sockets \ 打开sockets支持
–with-xmlrpc \ 打开xml-rpc的c语言
–enable-soap \ soap模块的扩展
–enable-short-tags \ 开始和标记函数
–enable-static \ 生成静态链接库
–with-xsl \ 打开XSLT文件支持,扩展libXML2库,需要libxslt软件
–with-fpm-user=nginx \ 指定php-fpm的用户和组
–with-fpm-group=nginx \
–enable-ftp \ ftp支持
–enable-opcache=no \ 禁用php自带opcache
–with-config-file-path=/usr/local/php/etc 配置文件地址
路径可选参数
–with-config-file-path=PATH | Set the path in which to look for php.ini [PREFIX/lib] | php.ini文件位置 |
–with-config-file-scan-dir=PATH | Set the path where to scan for configuration files | 扫描配置文件的路径 |
功能模块可选
–with-mysqli=mysqlnd
–enable-gettext
一般来说–with-config-file-path=PATH的参数除了HFS规格层级不一样,如路径为/etc 方便统一管理不设置则会放到lib目录
php5.5已经失效的参数
–enable-safe-mode
–enable-zend-multibyte http://blog.csdn.net/rongyongfeikai2/article/details/19680311
configure之后,就是make 和make install了 稳定版以外make test是可以考虑的选项,但是不发邮件报告的话并没有什么用
其他编译前后的注意事项
编译前
1、建议先确认libtool并升级到最新版本
2、编译常见缺少动态链接库的错误
/root/tools/php-5.3.27/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] 错误 127
解决办法:
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
3、make: *** [ext/phar/phar.php] 错误 127——5.3的错误问题,5.5似乎已经修复,不用手动touch这个文件
编译后
1、加prefix编译到指定软件路径要建立软连接方便调用 ln -s /application/php5.3.27/ /application/php
2、复制5.5.38源码解压文件夹中的php.ini-production /application/php/lib/php.ini拷贝php.ini需要配置文件<
3、cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf拷贝php-fpm配置文件
4、[root@lnmp01 php]# /application/php/sbin/php-fpm启动php-fpm
关于mysql连接
mysqli是在普通mysql的基础上做的一次优化 说实话 很成功 预处理方式完全解决了sql注入的问题
但是唯一的不足点 就是只支持mysql数据库 当然 如果你要是不操作其他的数据库或者 当然这无疑是最好的选择
PDO则是最新出来的一种 连接方式 兼容大部分数据库 也解决了sql注入 但是也有缺点 它只支持php5以上的版本 不过听说在未来的php6中 只支持这种连接
PDO统一所有数据库抽象层对象接口pdo-mysql是pdo在mysql的实现,mysqli只统一mysql的接口
- 上一篇 >:利用ssh密钥对实现免秘钥登陆管理和批量分发
- 下一篇 >:在电脑和安卓设备之间使用 FTP 传输文件