第一步:進入php源碼中的"ext/mysql"目錄下
命令:cd
第二步:在當前目錄下運行phpize
命令:/usr/local/php524/bin/phpize
phpize的規則:去哪個目錄下運行phpize文件,那么就會在該目錄下生成一個configure文件。
第三步:運行剛才生成的configure文件
命令: ./configure --with-php-config=/usr/local/php524/bin/php-config --with-mysql=/usr/local/mysql/
這里最關鍵的是通過--with-mysql參數告訴mysql客戶端的位置。這樣才能生成mysql.so。
實驗的時候,沒有加這個參數,結果錯誤:
./configure --with-php-config=/usr/local/php524/bin/php-config
第四步:編譯生成.so文件。最終要的東西
make
make install
結束/////////////////////////////////////////////////////////
第五步:配置php.ini加載該擴展
extension=mysql.so