配置nginx+php+mysql遇到的问题
2017-01-19 11:43
363 查看
因为使用某个框架,框架要求必须是php5.4版本,而博主的系统centos6.6在源上没有相应版本,因为一些特殊需求考虑需要编译。以下来写一些个人所遇到的问题。其次提示大家在baidu或者网上看攻略的时候请多看几个对比下,因为每个人遇到的情况和需求可能不同,还有就是网上复制粘贴的人太多了。
先更新下最近的openssl扩展开启,因为框架需要用到composer安装,而composer安装的时候又需要php支持openssl,博主的情况是提前已经编译安装好了PHP,后来需要用到其他扩展希望动态编译进去。所以用到了phpize。
首先我是直接去下载composer了
首先进入我的php解压包根目录,并且进入对应的扩展目录
执行phpize(目录为博主指定安装的php目录,参考者根据自己目录使用)
执行后发现找不到.m4文件,ERROR:
config0.m4就是config.m4,在当前目录下(每个扩展目录下都有)。直接copy
把PHP加入系统环境变量,再次执行会出现以下报错
网友给的解决办法是:
再次执行
接下来编译
接下来 make make install
make install会返回一些so文件的拷贝目录 后面需要用到
接下来去php.ini里面加载so文件
再次执行composer下载
安装完毕一定要重启nginx或者apache,以后就可以很熟练的使用phpize了
先更新下最近的openssl扩展开启,因为框架需要用到composer安装,而composer安装的时候又需要php支持openssl,博主的情况是提前已经编译安装好了PHP,后来需要用到其他扩展希望动态编译进去。所以用到了phpize。
首先我是直接去下载composer了
curl -sS https://getcomposer.org/installer | php //这个地址是国外的访问比较慢,有时候会提示php语法错误这个可以不用理会,取消之后再次执行多试几次就会好 //返回结果 Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with --with-openssl
首先进入我的php解压包根目录,并且进入对应的扩展目录
cd /root/php5.6.5/ext/openssl
执行phpize(目录为博主指定安装的php目录,参考者根据自己目录使用)
/usr/local/php/bin/phpize //这里为你自己的phpize路径,如果找不到,使用whereis phpize查找
执行后发现找不到.m4文件,ERROR:
Cannot find config.m4. Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module
config0.m4就是config.m4,在当前目录下(每个扩展目录下都有)。直接copy
copy config0.m4 config.m4
把PHP加入系统环境变量,再次执行会出现以下报错
Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
网友给的解决办法是:
cd /usr/src wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz tar -zvxf m4-1.4.9.tar.gz cd m4-1.4.9/ ./configure && make && make install cd ../ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz tar -zvxf autoconf-2.62.tar.gz cd autoconf-2.62/ ./configure && make && make install //更简单的办法 # yum install m4 # yum install autoconf
再次执行
PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226
接下来编译
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
接下来 make make install
//make结果: /bin/sh /root/php-5.6.5/ext/openssl/libtool --mode=compile cc -I. -I/root/php-5.6.5/ext/openssl -DPHP_ATOM_INC -I/root/php-5.6.5/ext/openssl/include -I/root/php-5.6.5/ext/openssl/main -I/root/php-5.6.5/ext/openssl -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php-5.6.5/ext/openssl/openssl.c -o openssl.lo mkdir .libs cc -I. -I/root/php-5.6.5/ext/openssl -DPHP_ATOM_INC -I/root/php-5.6.5/ext/openssl/include -I/root/php-5.6.5/ext/openssl/main -I/root/php-5.6.5/ext/openssl -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php-5.6.5/ext/openssl/openssl.c -fPIC -DPIC -o .libs/openssl.o /bin/sh /root/php-5.6.5/ext/openssl/libtool --mode=compile cc -I. -I/root/php-5.6.5/ext/openssl -DPHP_ATOM_INC -I/root/php-5.6.5/ext/openssl/include -I/root/php-5.6.5/ext/openssl/main -I/root/php-5.6.5/ext/openssl -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php-5.6.5/ext/openssl/xp_ssl.c -o xp_ssl.lo cc -I. -I/root/php-5.6.5/ext/openssl -DPHP_ATOM_INC -I/root/php-5.6.5/ext/openssl/include -I/root/php-5.6.5/ext/openssl/main -I/root/php-5.6.5/ext/openssl -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php-5.6.5/ext/openssl/xp_ssl.c -fPIC -DPIC -o .libs/xp_ssl.o /bin/sh /root/php-5.6.5/ext/openssl/libtool --mode=link cc -DPHP_ATOM_INC -I/root/php-5.6.5/ext/openssl/include -I/root/php-5.6.5/ext/openssl/main -I/root/php-5.6.5/ext/openssl -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o openssl.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/php-5.6.5/ext/openssl/modules openssl.lo xp_ssl.lo -lssl -lcrypto cc -shared .libs/openssl.o .libs/xp_ssl.o -lssl -lcrypto -Wl,-soname -Wl,openssl.so -o .libs/openssl.so creating openssl.la (cd .libs && rm -f openssl.la && ln -s ../openssl.la openssl.la) /bin/sh /root/php-5.6.5/ext/openssl/libtool --mode=install cp ./openssl.la /root/php-5.6.5/ext/openssl/modules cp ./.libs/openssl.so /root/php-5.6.5/ext/openssl/modules/openssl.so cp ./.libs/openssl.lai /root/php-5.6.5/ext/openssl/modules/openssl.la PATH="$PATH:/sbin" ldconfig -n /root/php-5.6.5/ext/openssl/modules ---------------------------------------------------------------------- Libraries have been installed in: /root/php-5.6.5/ext/openssl/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'.
make install会返回一些so文件的拷贝目录 后面需要用到
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ [root@VM_20_231_centos openssl]# make install /bin/sh /root/php-5.6.5/ext/openssl/libtool --mode=install cp ./openssl.la /root/php-5.6.5/ext/openssl/modules cp ./.libs/openssl.so /root/php-5.6.5/ext/openssl/modules/openssl.so cp ./.libs/openssl.lai /root/php-5.6.5/ext/openssl/modules/openssl.la PATH="$PATH:/sbin" ldconfig -n /root/php-5.6.5/ext/openssl/modules ---------------------------------------------------------------------- Libraries have been installed in: /root/php-5.6.5/ext/openssl/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
接下来去php.ini里面加载so文件
cd vim /usr/local/php/lib/php.ini //在最后一行加上 extension=openssl.so
再次执行composer下载
curl -sS https://getcomposer.org/installer | php Downloading... Composer (version 1.3.1) successfully installed to: /root/composer.phar Use it: php composer.phar Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: The zlib extension is not loaded, this can slow down Composer a lot. If possible, install it or recompile php with --with-zlib The php.ini used by your command-line PHP is: /usr/local/php/lib/php.ini If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times. //提示安装已经成功,但是被警告我没有安装zlib扩展,于是我再次按照安装openssl的方式再次安装
安装完毕一定要重启nginx或者apache,以后就可以很熟练的使用phpize了
相关文章推荐
- windows下的php、nginx、mysql配置记录和问题汇总
- debian下配置nginx+php+mysql 遇到的坑
- 2016年搭建nginx+php+mysql遇到的一些问题
- 安装64位win7后配置php mysql Apache 遇到问题并解决~~
- PHP+Apache+MySQL 在配置环境时遇到的问题
- win2008 iis7.5下配置php 5.6 mysql遇到问题解决记录
- ubuntu nginx php mysql 网站架设过程中遇到问题的解决记录
- php+mysql+apache项目运行所遇到的一系列配置问题
- CentOS+Nginx+MySql+PHP搭建高并发网站服务器时遇到的问题备忘
- 配置php的mysql环境遇到的问题
- 浅谈初次搭建nginx+php+mysql遇到的问题
- [原创]配置php+nginx 时遇到的”file not found","access denied"奇怪问题的解决过程
- 配置Apache+PHP+MySql时可能遇到的问题总结
- Discuz论坛2.5 升级到PHP MySQL新版遇到的问题
- Discuz论坛2.5 升级到PHP MySQL新版遇到的问题
- windows下配置PHP5.2.5+Apache 2.2.9+MySQL 6.0.5问题解决
- Discuz论坛2.5 升级到PHP MySQL新版遇到的问题
- phpMyAdmin“无法载入 mysql 扩展, 请检查 PHP 配置”问题的解决方案
- Discuz论坛2.5 升级到PHP MySQL新版遇到的问题
- Ubuntu 配置 NginX + PHP + FastCGI + MySQL 原来如此简单