Results 1 to 5 of 5
  1. #1

    Question PHP - Warning: Failed opening...c:\php4\pear...

    Hi Guys,


    I am working on a PHP/MySQL project this week but I have ran in to a little snag that is driving me crazy.

    Here at the office I have a Windows 2000 Server set up running PHP and MySQL.

    I have been testing my application locally on Windows 2000, but the actual environment that the program will be running on is *nix.

    Now, here is the thing....on my local Windows 2000 Server running PHP, I get an error when I try to include a file.

    This does NOT happen on the *nix environment.


    Here is the error I am getting:


    Warning: Failed opening 'http://www.webhostingtalk.com/' for inclusion ('include_path='.;c:\php4\pear') in C:\Inetpub\wwwroot\test.php on line 6


    I used "'http://www.webhostingtalk.com" as an example, but the include is a remote file.

    My include looks like: <?php include("http://www.webhostingtalk.com"); ?>

    Now, I don't even have a c:\php4\pear directory, so I have no idea where that is coming from.

    Again, all is well on the *nix machine, so I really think it is a Windows issue.

    Anyway, I'm not looking for any flames about using Windows as my testing environment or anything, just looking for a little help from anyone

    Can someone Please help me with this? I would really like to test this part of the application without having to upload.


    Thanks so Much!


    Eric

  2. #2
    Join Date
    Sep 2002
    Location
    Dallas, TX
    Posts
    205
    I can offer a few suggestions.

    First, PEAR (http://pear.php.net) is a PHP project aimed at creating standards for common functionality. Such as server-neutral database access, security mechanisms, etc. The include you see is likely just there by default.

    Second, the use of include() to retrieve remote files is not supported on Windows versions of PHP prior to 4.3, which is likely the problem as it has not yet been released.

    An easy way to check your PHP version (and lots of other info) is to create a script that simply calls the function phpinfo().

    Finally, if your version of PHP does indeed support the functionality, be sure it is enabled by checking the allow_url_fopen in your php.ini.

    I hope this helps!

    cortices
    Programmer/Sysadmin
    justin@criticalcube.com
    http://www.webhostingtalk.com/showth...threadid=77868

  3. #3
    Thanks a lot Justin,

    I am running PHP Version 4.2.3 and the allow_url_fopen is set to 'On'

    But, you are saying:

    ...the use of include() to retrieve remote files is not supported on Windows versions of PHP prior to 4.3, which is likely the problem as it has not yet been released.

    So basically I cannot use Include with Windows? How Odd.


    Thanks!

  4. #4
    Join Date
    Sep 2002
    Location
    Dallas, TX
    Posts
    205
    So basically I cannot use Include with Windows? How Odd.
    You can use the include() function. Just not to retrieve remote files. You should have no problem including files on the local system.

    PHP on Windows has always been extremely poor compared to the *nix implementation. New features are almost appear in the *nix version *well* before the Windows version.

    I have run into this many, many times.

    As to your problem, one possible alternative to using include() for this purpose is to instead use the fopen() function which does not appear to have the same limitation.

    The function reference page is http://www.php.net/manual/en/function.fopen.php.

    Good luck.
    justin 'at' abrogo.com
    http://www.abrogo.com
    Shared Unix Hosting

  5. #5
    Thanks Again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •