简体   繁体   English

PHP无法解析主机

[英]PHP Unable to Resolve Hosts

First discovered when PHP cURL failed to resolve hostnames. 当PHP cURL无法解析主机名时首次发现。 fopen('google.com', 'r') also fails with same error. fopen('google.com', 'r')也会因相同的错误而失败。

I checked my php.ini settings and allow_url_fopen = On 我检查了我的php.ini设置,然后allow_url_fopen = On

I'm running a custom compiled PHP-FPM with Nginx. 我正在使用Nginx运行自定义的已编译PHP-FPM。 Here is my configure command: ./configure --disable-rpath --disable-cli --disable-cgi --enable-fpm --with-fpm-user=php --with-fpm-group=php --enable-mbstring --enable-mbregex --enable-bcmath --enable-zip --enable-sockets --enable-pdo --enable-opcache --enable-ftp --with-regex --with-mhash --with-curl --with-zlib --with-pcre-regex --with-mcrypt --with-openssl --with-gd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd 这是我的配置命令: ./configure --disable-rpath --disable-cli --disable-cgi --enable-fpm --with-fpm-user=php --with-fpm-group=php --enable-mbstring --enable-mbregex --enable-bcmath --enable-zip --enable-sockets --enable-pdo --enable-opcache --enable-ftp --with-regex --with-mhash --with-curl --with-zlib --with-pcre-regex --with-mcrypt --with-openssl --with-gd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd

I can run any commands requiring resolving dns resolution ( wget , ping , etc.) work fine on the command line and resolv.conf is fine. 我可以在命令行上运行任何需要解析dns解析度的命令( wgetping等),而resolv.conf很好。 I'm running Cent OS 6.5 我正在运行Cent OS 6.5

Is there anything I missed to get PHP to start resolving hostnames? 我有什么想让PHP开始解析主机名的东西吗?

I figured it out to be a chroot config in the PHP. 我发现它是PHP中的chroot配置。 Can't do chroot without all the appropriate libraries in the chroot. 没有chroot中所有合适的库,就无法执行chroot。

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

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