5.x开始,PHP连接MYSQL无论使用哪种方式都是使用的mysqlnd驱动(当然是在你安装好的时候)。包括mysql_*、PDO_MYSQL、MYSQLi
在编译安装PHP的时候,需要指定开启以下扩展
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd 而不再是 --with-mysqli=/usr/local/mysql
php-fpm以root运行 php-fpm -R
./configure --prefix=/usr/local/php --enable-fpm --enable-sockets --enable-mbstring=all --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
http://www.imooc.com/wenda/detail/418852
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_rootfastcgi_script_name;
include fastcgi_params;
}
fastcgi_params 文件中含有各个nginx常量的定义,默认情况 SCRIPT_FILENAME =$fastcgi_script_name
fastcgi_param SCRIPT_FILENAME /scriptsfastcgi_script_name
其中$fastcgi_script_name就是请求url中的文件名,比如
ip/abc.php就是去/scripts找abc.php这个文件,我的理解。。。
这句话不加会导致访问php文件全都是空白。
fastcgi_param SCRIPT_FILENAME fastcgi_script_name;
其中 $document_root就是上面的root对应的html目录。
https://www.imooc.com/article/39106
nginx调用fcgi流程:https://www.cnblogs.com/liaojiafa/p/6046226.html
./configure --prefix=/usr/local/php --enable-fpm --enable-sockets --enable-mbstring=all --with-config-file-path=/usr/local/php/etc
Cannot find config.m4.:
cp config0.m4 config.m4
Cannot find autoconf
apt-get install m4 autoconf
扩展安装
默认按照如下方式安装的扩展,重启即可实现扩展的新增,
1.openssl
/usr/local/php/bin/phpize
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
make
make install
编译 --with-openssl的时候出现
configure: error: Cannot find OpenSSL’s
解决办法是安装libssl-dev.
如果不可以的话:
sudo apt-get install openssl
sudo apt-get install libcurl4-openssl-dev
然后再sudo apt-get install libssl-dev即可安装openssl
make && make install
2.pdo_mysql
mysql安装
https://blog.csdn.net/weixx3/article/details/80782479
https://blog.csdn.net/sinat_21302587/article/details/76870457
https://www.cnblogs.com/super-zhangkun/p/9435974.html
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql -with-zlib-dir=/usr/lib//可以不加???
make && make install
php添加pdo_mysql 扩展时报错 fatal error: ext/mysqlnd/mysqlnd.h: No such file or directory
打开那个文件,把相对路径前面填上绝对路径。
3.redis
redis安装
https://www.cnblogs.com/zongfa/p/7808807.html
https://github.com/phpredis/phpredis/releases 找到合适的版本下载
wget https://github.com/phpredis/phpredis/archive/4.2.0.tar.gz
tar zxvf 4.2.0.tar.gz
cd phpredis-4.2.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
fatal error: ext/standard/php_smart_str.h: No such file or directory
/root/mydown/php-7.3.0/ext/standard/php_smart_string.h