This error occurs:
Warning: include() [function.include]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/ldbhome.biz/cooking/crock/index.php on line 84

Warning: include(http://xpm3ggw/ldbhome.biz/cooking/mnu.php) [function.include]: failed to open stream: No such file or directory in /var/www/ldbhome.biz/cooking/crock/index.php on line 84

However, if I copy the path in the error message script and paste it into the browser, it displays.

The code is

<?php echo "$hosta/mnu.php<br />";include "$hosta/mnu.php";?>

$hosta is a var that is set according to whether I'm on the dev box or on the hosting server. The echo statement was inserted to test that it is showing the right info - it is.

This works on the hosting server, just not on my dev box. It worked when I was using Ubuntu 7.10. I recently upgraded to Ubuntu 8.04.

'Twould seem to be a config issue, but I've no idea where to look. Don't know it's PHP config, Apache2 config, or Ubuntu config. I've found this error referenced in several messages, but none of the fixes - mostly for fopen() or fsock() - have helped.

I enabled the fopen wrappers in php.ini, but that has not resolved the issue.

I'm at a total loss here, would appreciate any assistance.

Make a good day ...
... barn

    if it's having trouble resolving hostnames (which it looks like it might be), check to make sure your DNS settings are correct on the dev box. Make sure you can do:

    dig www.google.com
    

    and get a response.

      Jim,

      I did that, got a response. The last four lines are posted following.

      ;; Query time: 51 msec
      ;; SERVER: 216.82.202.14#53(216.82.202.14)
      ;; WHEN: Wed May 28 15:28:15 2008
      ;; MSG SIZE  rcvd: 340
      

      Now, I have no idea what any of the response signifies, although I suspect it is providing IP and name server data for some of the Google servers.

      If that obviates a DNS issue, where would I look next? It takes 2-3 times as long to test a page when I have to upload changed files to the host, then replace them with their predecessors if the change doesn't work as planned.

      Side note: this seems to occur only on include files that are not in the same directory as the page calling them.

        Well the first problem you should note is that you're trying to use include() over an HTTP stream.

        What is $hosta set to? If it is anything resembling a URL, that's your problem; you don't want a URL, you want a path relative to the local filesystem.

          bradgrafelman wrote:

          Well the first problem you should note is that you're trying to use include() over an HTTP stream.

          What is $hosta set to? If it is anything resembling a URL, that's your problem; you don't want a URL, you want a path relative to the local filesystem.

          Hm-m-m ... on the face of it, I can accept that argument. But that doesn't explain why it has worked every place but my current Ubuntu 8.04 install. It works on my beta testing domain: it worked on Ubuntu 7.10: it works on WinXP. It just doesn't work on 8.04.

          The reason for using a full URI for the include is two-fold:

          1. I won't always know the path on a remote system

          2. In some instances, the include file is called from a different domain so that I can keep current the content of the file

          Granted, that may not be the best procedure, but it's one that has stood me in good stead for the last several years, since 2000-2001.

          If there's a way to determine the local path - some PHP function? - I'm ignorant of it.

          However, that still leaves the problem of running the script on domainA and calling the include from the domainB repository.That is partly a support issue, partly a matter of convenience, If a global change is needful, it's much easier to make it in one place than to copy it over to every location. That's the reason I quit using Visual Basic/MSSSQL/Access and switched to PHP/MySQL in the first place <sigh />.

            If all you're trying to do is include some static HTML file on another server, then readfile() or file_get_contents() would be more applicable; include()/require() should only be used for loading PHP scripts for parsing; this obviously can't be done across an HTTP connection as the PHP code will already be processed and all you're getting is the output.

            Also note that you don't need to know the full local path, just a relative path. Also, if you know the file you want is in a directory called "includes" in the root of the website, you could do:

            include($_SERVER['DOCUMENT_ROOT'] . '/includes/myfile.php');
              bradgrafelman wrote:

              If all you're trying to do is include some static HTML file on another server, then readfile() or file_get_contents() would be more applicable; include()/require() should only be used for loading PHP scripts for parsing; this obviously can't be done across an HTTP connection as the PHP code will already be processed and all you're getting is the output.

              Also note that you don't need to know the full local path, just a relative path. Also, if you know the file you want is in a directory called "includes" in the root of the website, you could do:

              include($_SERVER['DOCUMENT_ROOT'] . '/includes/myfile.php');

              OK, I really do appreciate you trying to help.

              But it's irritating and frustrating when someone says that what is currently working cannot be done!

              Please understand. This works! At least to date. It works everywhere except on my home box.

              The mnu.php file I'm trying to include generates a menu. That menu is dynamic in that it changes, sometimes from one day to the next, sometimes from one hour to the next.

              The output that I want to see is the processed output of that file.

              It works on the hosting server.

              It works on WinXP

              It worked on Ubuntu 7.10.

              It doesn't work on Ubuntu 8.04.

              Maybe more background is in order.

              I ran an upgrade process to bring Ubuntu up from 7.10 to 8.04.

              Everything looked good until I rebooted. Ubuntu could not load.

              I loaded the ISO of 8.04 onto a different partition. Then I had to reload all the LAMP stuff, as well as most everything else. The install 'upgraded' my Firefox to v3 beta 5, wiping out most of the utility that I had with Firefox 2.x because the extensions I had loaded mostly don't work with v3.
              I was able to recover a great deal from the 7.10 partition - I could see it, I just couldn't run it. What I could not recover, I downloaded from my hosting servers. The scripts I'm talking about now are running on of those servers.

              Somewhere in this reinstall process, some component was changed such that what worked before in LAMP does not work the same.

              What I'm trying to discover is what changed. If I don't understand that, I have no idea what might or might not work in the future.

              If it's a procedural change, then I'll adapt.

              But if it's a config change, I need to understand what that change might be.

              I'm trying to find an answer, not an alternative - I have alternatives, they're just unattractive and somewhat less efficient.

              Again, I don't mean to offend, but I'm looking for an answer to the problem, not alternatives.

                But it's irritating and frustrating when someone says that what is currently working cannot be done!

                Please understand. This works! At least to date. It works everywhere except on my home box.

                What bradgrafelman says cannot be done is loading a remote PHP script for parsing via include or require. What you want is "the processed output of that file", and that certainly can be done over a remote connection (and in fact we do it everytime we load a PHP page in our web browser). (Of course, if the remote PHP script is not parsed as a PHP script to begin with but treated as an ordinary plain text file, then you can indeed request it remotely and then eval() it locally, but that can be rather insecure.)

                Consequently, there is no use bothering with include or require when you can use [man]file_get_contents/man and such, which are more appropriate.

                EDIT:
                That said, switching to file_get_contents() may not necessarily fix anything, though it is better than include for this purpose. I suggest that you post the smallest and simplest script that demonstrates the problem. If you need to use a dummy domain name, use http://www.example.com. If you need to use a dummy file system path, use /var/www. Also, post the exact error message you get (changing pathnames if necessary).

                  Write a Reply...