I keep getting 5 PHP errors when i'm opening and reading two files:

Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/flaio/public_html/more/index.php on line 21

Warning: fopen(http://flaio.com/ver.html): failed to open stream: Permission denied in /home/flaio/public_html/more/index.php on line 21

Warning: fgets(): supplied argument is not a valid stream resource in /home/flaio/public_html/more/index.php on line 23

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/flaio/public_html/more/index.php on line 36

Warning: file_get_contents(http://flaio.com/index.php?act=rss&feed=titles): failed to open stream: Permission denied in /home/flaio/public_html/more/index.php on line 36

On my localhost, running PHP 5.0.3 it works perfectly fine. However, when I put it on my server, which is running PHP 4.3.11, I get the 5 above errors. Can someone explain to me what they mean/how to fix them?

EDIT: I know that the files are broken, but I changed them for security. They are not broken in real life.

    make sure the php on the server is setup to open [url]http://[/url] files in fopen and file_get_contents. you will want to make a file with
    <?php phpinfo(); ?>
    in it and check for allow_url_fopen = on and registered php streams http

      allow_url_fopen is on, and I don't know how to check for the registered php streams http.

        it should say it in the top box of the output.

          ok, then this:
          php_network_getaddresses: getaddrinfo failed: Name or service not known
          tells me there is something wrong with dns on the server. are you able to ping from the command line at all?

            Well, there probably is a problem because I just put my domain on those nameservers tonight, but the main page transfered so I'm not sure.

              being on new nameservers shouldnt matter really. just if the server is using dns it may have a problem

                Is there anyway to get around these errors (by using other php functions etc)?

                  If it based on DNS, then could I just use the IP address that he gave me inplace of the domain in my functions?

                    yeah, thats actually a good way to debug it and see what the issue is.

                      Yep, well when I put in the IP address he gave me it works fine. Should I contact my host about changing this? Is it a big deal if anyone who downloads my script sees the IP address?

                        yeah its no big deal really cause its simple to resolve an ip from your domain.
                        ive seen that happen if all the sockets on the server are busy, or if dns resolution isnt working properly.

                          Write a Reply...