In Fedora15, file_get_contents and soap cannot be used.

Source: Internet
Author: User
Recently, Fedora15 has been installed. However, after configuring the PHP development environment (php + nginx + mysql), it is found that the file_get_contents function and the soap-related function on the local machine cannot be used normally, an empty string is returned for all remote requests. It is finally resolved today. The process is recorded as follows: Fatalerror: UncaughtSoapFaultexception: [WSDL] soap-ERROR is returned when SOAP is called.

Recently, Fedora15 has been installed. However, after configuring the PHP development environment (php + nginx + mysql), it is found that the file_get_contents function and the soap-related function on the local machine cannot be used normally, an empty string is returned for all remote requests. The process is recorded as follows:

Return when calling soap:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'HTTP: // xx. xx. xx. xx/WS. asmx? WSDL ': Start tag expected,' <'not found

When the file_getcontents function is used, an empty string is returned.

Analysis may be caused by selinux

According to the online information, SELinux prevents the httpd daemon from communicating with the internet server.

Run the following two commands:

# Setsebool-P httpd_can_network_connect on
# Setsebool-P httpd_can_network_connect on

However, the problem persists after the command is executed, and the curl function can return data normally, excluding selinux;

Baidu found that the allow_url_fopen option value of php. ini may be Off. If it is not enabled, check that php. ini is On. This is not the reason.

Finally, I found on a foreign website that may be the cause of php and may be the problem of compilation parameters:

-With-curlwrapper needs to be removed during php compilation, So we re-compiled php5. The compilation command is as follows:

Tar zxvf php-5.2.13.tar.gz
Gzip-cd php-5.2.13-fpm-0.5.13.diff.gz | patch-d php-5.2.13-p1
Cd php-5.2.13/
. /Configure -- prefix =/usr/local/webserver/php -- with-config-file-path =/usr/local/webserver/php/etc -- with-mysql =/usr/ local/mysql-search -- with-mysqli =/usr/local/mysql-search/bin/mysql_config -- with-iconv-dir =/usr/local -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-libxml-dir =/usr -- enable-xml -- disable-rpath -- enable-discard-path -- enable -safe-mode -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl -- enable-mbregex -- enable-fastcgi -- enable-fpm -- enable -force-cgi-redirect -- enable-mbstring -- with-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash -- enable-pcntl -- enable -sockets -- with-ldap-sasl -- with-xmlrpc -- enable-zip -- enable-soap
Make ZEND_EXTRA_LIBS = '-liconv'
Make install

Restart php-fpm and nginx to solve the problem.

/Usr/local/webserver/php/sbin/php-fpm start

/Usr/local/webserver/nginx/sbin/nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.