本文目錄一覽:
- 1、重新編譯 PHP 4,並在標記中加上 MySQL 的路徑「
- 2、使用php鏈接mysql資料庫的時候報錯了,錯誤提示:Warning: mysqli::__construct(): (HY000/2002):
- 3、centos7編譯php出現問題 系統:CENTOS7 64位 PHP版本:7.1.0 APACHE版本:2.4.25 MYSQL版
- 4、download missing mysql driver files 是怎麼回事兒
- 5、php,下面的問題怎麼解決,提示mysql_query() expects parameter 2 to be resource, null given in
重新編譯 PHP 4,並在標記中加上 MySQL 的路徑「
1.通達文件出錯
2。資料庫錯誤。
你有沒有做備份啊,把備份的文件複製覆蓋原文件。
資料庫恢復。
使用php鏈接mysql資料庫的時候報錯了,錯誤提示:Warning: mysqli::__construct(): (HY000/2002):
$result = mysqli_query($connect, $query) or die (‘Error querying database.’);這句話後面加上. mysqli_error($connect ))即改為:
$result = mysqli_query($connect, $query) or die (‘Error querying database.’. mysqli_error($connect )));
查看一下返回什麼錯誤描述,然後根據錯誤描述進行修改,當然也可以查看mysql的錯誤日誌啦
ps:光從代碼上沒看出錯誤,有可能資料庫里的欄位名你寫錯了
centos7編譯php出現問題 系統:CENTOS7 64位 PHP版本:7.1.0 APACHE版本:2.4.25 MYSQL版
1、php的編譯問題主要是依賴包沒有提前安裝
2、如果依賴mysql,就先安裝mysql-devel或編譯mysql
3、需要提前安裝的有,不能寫太細,太細會被度娘屏蔽:
yasm-1.3.0.tar.gz
libmcrypt-2.5.8.tar.gz
libvpx-v1.3.0.tar.bz2
tiff-4.0.3.tar.gz
libpng-1.6.16.tar
freetype-2.5.4.tar.gz
jpegsrc.v9a.tar.gz
libgd-2.2.3.tar.gz
t1lib-5.1.2.tar.gz
4、安裝編譯php
5、安裝php後有一些優化包根據需要安裝
download missing mysql driver files 是怎麼回事兒
LAMP下的更新問題:系統是redhat9,自定義安裝了php,mysql,apache。所以在安裝最新的php,mysql,apache版本時候,本人對相關的rpm進行了卸載,忽略依賴關係強制卸載apache;由於php,mysql與perl的bt依賴關係,
LAMP下的更新中的問題
1.當你看到mysql有很多版本,如:
mysql-max-5.0.21-linux-i686-glibc23.tar.gz和
mysql-max-5.0.21-linux-i686.tar.gz
這倆個到底選哪個呢,請你使用如下命令來決定
# rpm -qa | grep glibc glibc-kernheaders-2.4-8.10 glibc-common-2.3.2-11.9 glibc-2.3.2-11.9 glibc-devel-2.3.2-11.9
如果出現以上信息,請選擇mysql-max-5.0.21-linux-i686-glibc23.tar.gz版本
2:編譯php時出現
./configure: /usr/local/apache2/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory
這是找不到perl解釋器的緣故。
修改/usr/local/apache2/bin/apxs文件中:
/replace/with/path/to/perl/interpreter
把他替換成perl所在的路徑如/opt/ActivePerl-5.8/bin/perl,
(如果你下載的是active perl5.8的rpm,他默認安裝路徑是/opt/ActivePerl-5.8/bin/perl)
3.安裝了perl後,發現所有的文本編輯器都不能用了。
運行vi或者gedit時候,提示找不到libperl.so
到perl的安裝目錄下找一個libperl.so放到/usr/lib目錄下就解決問題了
我的libperl.so在/opt/ActivePerl-5.8/lib/5.8.8/i686-linux-thread-multi-CORE/目錄下。
如果不知道libperl.so在什麼地方,可以用
# locate libperl.so
查找,或者用find命令
4.當我使用mysql-standard-5.0.20,編譯php時出現mysql錯誤:
checking for mSQL support… no checking for MSSQL support via FreeTDS… no checking for MySQL support… yes checking for specified location of the MySQL UNIX socket… no checking for MySQL UNIX socket location… /tmp/mysql.sock checking for mysql_close in -lmysqlclient… no checking for mysql_error in -lmysqlclient… no configure: error: mysql configure failed. Please check config.log for more information
.
LAMP下的更新中的問題,安裝PHP的時候沒有指定一下mysql的安裝目錄。但是我已經指定了,所以這個說法是錯誤的,其實主要原因是 mysql-level沒有裝,也就是mysql的版本不對,應該換
mysql-max-5.0.21版本(包含所有mysql相關內容的軟體包)
5.編譯php時出現
configure: error: freetype2 not found!
沒有安裝freetype-level
configure: error: libpng.(a|so) not found.
沒有安裝libpng-devel
6忘了mysql的root口令怎麼辦
# /usr/local/mysql/support-files/mysql.server stop # cd /usr/local/mysql/bin/ # mysqld_safe –skip-grant-tables # mysqladmin -u user password ‘newpassword’ # mysqladmin flush-privileges
增加pdo_mysql單獨安裝
原來編譯php的時候,沒有把dpo_mysql相關的參數帶上,安裝 完後才發現。再重新編譯有點費時間,所以決定單獨來安裝。
先找需要的版本,我用的是穩定的版本。要先看看說明,特別是要注意mysql的php的版本。
wget tar xzvf PDO_MYSQL-1.0.2.tgz cd PDO_MYSQL-1.0.2 /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 ./configure
執行完以後,報了個錯誤:
checking for mysql_config… not found configure: error: Cannot find MySQL header files under
這個錯誤表明系統預設沒有找到你的mysql安裝目錄,因此可以使用這個命令解決:
ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config
這樣建立了你的實際msyql安裝目錄和mysql_config命令的管理
經過configure就可以make了
在執行:./configure 時,又出現了一個問題:
checking for PDO includes… checking for PDO includes… configure: error: Cannot find php_pdo_driver.h.
檢查的時候,不能找到php_pdo_driver.h,經過檢查,發現在讀php-config的時候,在讀以前的配置。
解決方法:./configure –with-php-config=/usr/local/php/bin/php-config(根據實際的路徑的來指定)
在執行./configure –with-php-config=/usr/local/php/bin/php-config,又出現了一個問題:
error: mysql_query missing!?
解決方法:./configure –with-php-config=/opt/php5/bin/php-config –with-pdo-mysql=/opt/mysql5
(根據自己的實際路徑,設定編譯安裝mysql的位置).
make make install
注意pdo_mysql的全路徑,我的是:
/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
然後在/usr/local/lib/php.ini
加上一句:
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
重新啟動apache即可看到已經載入pdo_mysql成功。
LAMP下的更新中的問題有好多,這只是其中的一部分,如果大家還有什麼類似的問題的話,可以貼出來,一起解決一下。
php,下面的問題怎麼解決,提示mysql_query() expects parameter 2 to be resource, null given in
錯誤是因為你沒有連接資料庫就進行了查詢,正常的程序應該這樣寫:
function user_shell($nickname,$shell){
$conn=mysql_connect(‘127.0.0.1′,’root’,’123456′);
$query=mysql_query(“select * from xwego.members where nickname=’$nickname'”,$conn);
}
如果你在主程序裡面進行了連接了,可以試試看把語句:
$query=mysql_query(“select * from xwego.members where nickname=’$nickname'”,$conn);
修改為:
$query=mysql_query(“select * from xwego.members where nickname=’$nickname'”);
原創文章,作者:BNGC,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/137577.html