简体   繁体   English

php:数据库访问错误

[英]php: Database accessing Error

I have used "DB.php" package to do the database operation . 我已经使用“ DB.php”包进行数据库操作。 In my file I have connected the database and access the table values. 在我的文件中,我已连接数据库并访问表值。 It is working fine. 一切正常。 when I am running in command line interface . 当我在命令行界面中运行时。
But When I am running that php file in web browser it telling me following error 但是,当我在网络浏览器中运行该php文件时,它告诉我以下错误

Note :I am Using pgsql database 注意:我正在使用pgsql数据库

Can't connect: DB Error: extension not found

You'll have to check the script DB.php , but it most likely means an extension that's required to communicate with the database such as the mysqli or postgres extensions, is not loaded. 您必须检查脚本DB.php ,但这很可能意味着未加载与数据库进行通信所需的扩展,例如mysqlipostgres扩展。

See the manual on how to load extensions. 请参阅有关如何加载扩展的手册

Is your php.ini configured for the database that you are trying to connect to? 是否为要连接的数据库配置了php.ini? Are you using MySQL, SQLite ... 您正在使用MySQL,SQLite ...

http://www.bicubica.com/apache-php-mysql/index.php There is a section on "Configuring PHP" that would be helpful it sounds like. http://www.bicubica.com/apache-php-mysql/index.php在“配置PHP”一节中,听起来像是有帮助的。

Check that its using the same php.ini file for webserver and cli (look at output of phpinfo()). 检查其是否对Web服务器和cli使用相同的php.ini文件(查看phpinfo()的输出)。

Once you've established that the php.ini file is correct, if you're still getting the error check the permissions on the extension on the relevant .dll/.so files 确定php.ini文件正确后,如果仍然出现错误,请检查相关.dll / .so文件的扩展名权限

If the files and dirs are readable bu the webserver uid, then restart your webserver and check for startup errors. 如果文件和目录可以通过Web服务器uid读取,则重新启动Web服务器并检查启动错误。

HTH 高温超导

C. C。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM