本文操作環境:Windows7系統、php-7.1.5、Dell G3。
centos php7 安裝mysqli擴展心得
在新配服務器時發現,php無法連接到mysql。透過phpinfo發現。根本沒有顯示mysqli的相關配置。經過一系列研究。總結了下。:
第一步:
在phpinfo裏沒有mysqli配置,原因是安裝php7時沒有configure mysqli
安裝php方法:wget http://cn2.php.net/distributions/php-7.1.5.tar.gz
tar zxvf php-7.1.5.tar.gzcd php-7.1.5./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/bin/mysql_config 注:/usr/bin/mysql_config 這個路徑爲自己的mysql_config路徑 可透過 find -name mysql_config查找make && make install cp php.ini-development /usr/local/lib/php.inicp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpmchmod +x /etc/init.d/php7-fpmcd /usr/local/php/etccp php-fpm.conf.default php-fpm.confcp php-fpm.d/www.conf.default php-fpm.d/www.conf/etc/init.d/php7-fpm start 啓動php
安裝完之後會發現phpinfo有mysqli了
第二步:安裝mysqli擴展
方法:
cd /usr/local/php-7.1.5/ext/mysqli //到php檔案ext下的mysqli/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/bin/mysql_config
注:usr/bin/mysql_config 路徑同第一步方法
現在應該已經有mysqli擴展了
第三步:
修改php.ini
透過phpinfo 查找到php.ini的路徑。修改php.ini。取消註釋php_mysqi.dll
到此這篇關於php7 安裝mysqli實例講解的文章就介紹到這了,更多相關php內容請搜尋好二三四以前的文章,希望大家以後多多支援好二三四!
<link rel="stylesheet" href="https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da5ee921b51c/da42d322a20a.css" type="text/css" /><link rel="stylesheet" href="https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da5ee921b51c/da42c425b502dd685f0fcdad1b74.css" type="text/css" /><script type="text/javascript" src="https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d824b707d4455d01d8bd05.js"></script> <script>SyntaxHighlighter.autoloader( 'applescript https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06d4a19c0bd24631b48642f.js', 'actionscript3 as3 https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06d695a.js', 'bash shell https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06e5b1ac4.js', 'coldfusion cf https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06f5505c89e0273004e7a.js', 'cpp c https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06f4a19.js', 'obj-c objc https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0635803ef.js', 'c# c-sharp csharp https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06f6901cdaa07.js', 'css https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06f491a.js', 'delphi pascal https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0685f05dcb01e.js', 'diff patch pas https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd068530fca.js', 'erl erlang https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0694805cdb610.js', 'groovy https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06b4806c3ae0e.js', 'haxe hx https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0645b11c9.js', 'java https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0665b1fcd.js', 'jfx javafx https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0665b1fcd9e2f.js', 'js jscript javascript https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd066690adeb10774.js', 'perl pl https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07c5f1bc0.js', 'php https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07c5219.js', 'text plain https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07c5608c5b6.js', 'py python https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07c431dc4b719.js', 'ruby rails ror rb https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07e4f0bd5.js', 'scala https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07f5908c0b9.js', 'sql https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07f4b05.js', 'vb vbnet https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07a58.js', 'ps powershell https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd07c551ec9aa24680c4d78.js', 'xml xhtml xslt html https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd0745705.js', 'go golang https://js.how234.com/c359fc24b2/da53fe39b117d0455d01c0b110681d4466/da49e224a01bcb1e0a5b9e/da42d23fa51cd06b55.js' );</script> <script type="text/javascript"> SyntaxHighlighter.all(); </script>