Bug 590054

Summary: php is unable to use fopen functions on remote urls when apache is started automatically by upstart at boot
Product: [Fedora] Fedora Reporter: Tony White <twhite>
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: fedora, jorton, rpm
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-08 13:13:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tony White 2010-05-07 15:34:51 UTC
Description of problem:
php is unable to fopen. httpd it is started before name resolution.

Version-Release number of selected component (if applicable):
Apache/2.2.15 (Fedora)

How reproducible:
Every boot

Steps to Reproduce:
1. Boot your fedora LAMP server setup
2. Try to use an fopen php 5 function to retrieve a remote url using a php script (simplepie is a good one to try.)
3. Inspect the logs, there should be something like :
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in ...
  
Actual results:
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in ...
In the logs and the data from the url is not fetched.

Expected results:
Data from the url is fetched. No error message.

Additional info:
Restarting the httpd service solves the issue.
It is exactly this problem :
http://www.php.net/manual/en/function.fopen.php#33228
So if you reboot a fedora server, php fopen requests will not function because httpd is started before the name resolution occurs unless you restart httpd.

I have no idea if this bug should be against upstart or apache.

Comment 1 Mohamed El Morabity 2010-05-07 16:03:44 UTC
Anyway this bug doesn't rely on apache-commons-exec which is a Java library.
Changed "Component" field to "php".

Comment 2 Remi Collet 2010-05-07 17:19:47 UTC
For me, this is not a bug.

You are probably using NetworkManager, switch to network if you want a server with all daemon up in the right order.

Else (for a dev computer), don't start httpd à boot time.

Comment 3 Joe Orton 2010-05-08 13:13:12 UTC
Agree with Remi.  If you want to stick with NetworkManager, you can do:

  # echo NETWORKWAIT=1 >> /etc/sysconfig/network

to force NM to wait for a network at bootup.