我只是尝试使用Informix驱动程序创建与数据库的连接。
服务器在CentOS 6.4上运行,PDO_INFORMIX-1.3.1和clientsdk.4.10.FC2DE.LINUX。
我在/ etc / sysconfig / httpd中设置了env var,然后运行以下命令:
当我运行“php /var/www/html/informix.php”时,连接成功,但是当我在浏览器上调用相同的脚本时,我收到此错误:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE=08004, SQLDriverConnect: -908 [Informix][Informix ODBC Driver][Informix]Attempt to connect to database server (cms_net) failed.' in /var/www/html/informix.php:30 Stack trace: #0 /var/www/html/informix.php(30): PDO->__construct('informix:host=1...', 'user', 'xxxxx') #1 {main} thrown in /var/www/html/informix.php on line 30
我尝试在/ etc / hosts中设置主机,但没有成功。
我不知道如何解决这个问题。有人可以帮帮我吗?
答案 0 :(得分:1)
我解决了这个问题。实际上,SELinux就是原因。我只是做
setsebool -P httpd_can_network_connect=1