| Summary: | fopen function always failed | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Yann Ciret <mageia> |
| Component: | RPM Packages | Assignee: | Marc Krämer <mageia> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | Normal | CC: | mageia, marja11 |
| Version: | 6 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | php-5.6.38-1.mga6.src.rpm | CVE: | |
| Status comment: | |||
|
Description
Yann Ciret
2018-10-19 08:56:47 CEST
Marja Van Waes
2018-10-20 13:43:44 CEST
Assignee:
bugsquad =>
php I can not confirm this.
Running the following test script:
<?php
$handle=fopen('http://builds.matomo.org/piwik.zip?cb=3.6.1','r');
echo strlen(fread($handle,20));
fclose($handle);
?>
runs fine, and gives 20 bytes from the stream. No problem in name resolution. Looks more like a configuration problem of the network / name resolution to me.
Did you allow url opening in your php.ini???
; http://php.net/allow-url-fopen
allow_url_fopen = OnAssignee:
php =>
mageia (In reply to Marc Krämer from comment #1) > I can not confirm this. > Running the following test script: > <?php > $handle=fopen('http://builds.matomo.org/piwik.zip?cb=3.6.1','r'); > echo strlen(fread($handle,20)); > fclose($handle); > ?> > > runs fine, and gives 20 bytes from the stream. No problem in name > resolution. Looks more like a configuration problem of the network / name > resolution to me. > > Did you allow url opening in your php.ini??? > > ; http://php.net/allow-url-fopen > allow_url_fopen = On Hello Marc, As I mention in my first message, allow_url_fopen is autorised in php.ini. I tested your script and the result gives 0. And wget works, so this is not a network configuration problem. This is the result of your script in error logs: [Sun Oct 21 23:47:34.797998 2018] [:error] [pid 24302] [client 82.235.164.210:49660] PHP Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/suivi/test.php on line 2 [Sun Oct 21 23:47:34.798079 2018] [:error] [pid 24302] [client 82.235.164.210:49660] PHP Warning: fopen(http://builds.matomo.org/piwik.zip?cb=3.6.1): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/suivi/test.php on line 2 [Sun Oct 21 23:47:34.798109 2018] [:error] [pid 24302] [client 82.235.164.210:49660] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /var/www/html/suivi/test.php on line 3 [Sun Oct 21 23:47:34.798136 2018] [:error] [pid 24302] [client 82.235.164.210:49660] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/suivi/test.php on line 4 phpinfo() confirm allow_url_fopen = On. Regards Yann For precision, my server is IPv4 only. It is weird. When you go on https://mars.zamiz.net/suivi/test.php, the result is 0. But if I launch the test with apache user in command line, the result is 20. $ php html/suivi/test.php 20 - do you run php as apache module or via cgi (php-fpm)? can you replace the url in the script to a) http://google.com b) http://173.194.79.113 so, we can see, if this is a general network problem or only the name resolution. - do you have a firewall running, which may prevent outgoing traffic? for me this is the apache module. You can see phpinfo at https://mars.zamiz.net/suivi/test.php with modification in script: a/ it failed b/ it failed [Mon Oct 22 19:05:43.094730 2018] [:error] [pid 13878] [client 82.235.164.210:58554] PHP Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/suivi/test.php on line 3 [Mon Oct 22 19:05:43.094808 2018] [:error] [pid 13878] [client 82.235.164.210:58554] PHP Warning: fopen(http://173.194.79.113): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/suivi/test.php on line 3 [Mon Oct 22 19:05:43.094835 2018] [:error] [pid 13878] [client 82.235.164.210:58554] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /var/www/html/suivi/test.php on line 4 [Mon Oct 22 19:05:43.094859 2018] [:error] [pid 13878] [client 82.235.164.210:58554] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/suivi/test.php on line 5 About firewall, I don't think. If this is the case, the flow should never work. Only ongoing traffic is filtered. is it possible issue comes from bad hosts.allow and hosts.deny config? hosts.allow: http: ALL https: ALL sshd: ALL EXCEPT /etc/hosts.evil svn: ALL hosts.deny: ALL:ALL EXCEPT 127.0.0.1:DENY I found! The problem came from a bad configuration in the php.ini file. The option "always_populate_raw_post_post_data = -1" was enabled. A relic of an update certainly. After disabled it, all work fine. Thank you for your time. Status:
NEW =>
RESOLVED |