Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Warning: file(search_template.html): failed to open stream..

  1. #1
    Join Date
    Jan 2006
    Posts
    11

    Default Warning: file(search_template.html): failed to open stream..

    I'm testing Zoom on a client's site with the hopes of getting it to work and purchasing a Zoom Professional license. I'm very impressed with Zoom, but unfortunately I'm running into a small problem that I can't seem to resolve on my own.

    I'm using Zoom Free, Version 4.2(Build 1007). The site is being hosted by Interland on a shared server(unfortunately) which is running PHP Version 4.3.10.

    I am getting the following error;

    "Warning: file(search_template.html): failed to open stream: No such file or directory in d:\Customers\user1177213\www\search.php on line 586"

    Line 586 of search.php is: $template = file ($TemplateFilename);

    Looking at the PHP, I don't see where the variable $TemplateFilename is defined, but the warning message seems to indicate that it's defined as search_template.html. I have verified that the search_template.html file has been uploaded to the server along with the rest of the Zoom-generated files. I placed them all in the www root directory, since that's the only place where PHP files will actually work on this server. I'm not sure what else to do, short of altering the PHP code, which is likely to do more harm than good.

    I have had some other issues with Interland's limited PHP configuration and support... can you please give me some insight into this problem so I can upgrade the software and get the search page up and running?

    Any help would be very appreciated.

    [ED UPDATE: For other readers who don't want to read all of this long topic, but have the same problem: The root cause of this problem was an incorrect working directory for PHP. As a result of this, all relative file references were failing. Interland, the web host, corrected the PHP configuration and fixed the problem.]

  2. #2
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,156

    Default

    You are correct that $TemplateFilename is defined as search_template.html. This is done in the settings.php file.

    I assume you have checked the file permissions on the search_template.html file and it allows opening and reading?

    These type of file open operations appear to be supported at Interland, see,
    http://answers.interland.com/display...=19116&n=19&s=

    You could always write a very small PHP script to test the function on your server.

    <?php
    $handle = fopen("search_template.html", "r");
    ?>

    OR

    <?php
    $template = file (search_template.html);
    ?>

    ----
    David

  3. #3
    Join Date
    Jan 2006
    Posts
    11

    Default

    David,

    Thank you for your reply. I think the link you offered was prematurely truncated. I'll go and try to find the file permissions help page myself, but it would be helpful if you could repost that link for me.

    I tried your PHP test suggestions, creating files containing only what you suggested, and I got the following results:

    fopen_test.php looks like:
    Code:
    <?php
    $handle = fopen&#40;"search_template.html", "r"&#41;;
    ?>
    ... and yields the following in a browser:
    Warning: fopen(search_template.html): failed to open stream: No such file or directory in d:\Customers\user1177213\www\fopen_test.php on line 2

    file_test.php looks like:
    Code:
    <?php 
    $template = file &#40;search_template.html&#41;; 
    ?>
    ... and yields the following in a browser:
    Notice: Use of undefined constant search_template - assumed 'search_template' in d:\Customers\user1177213\www\file_test.php on line 1

    Notice: Use of undefined constant html - assumed 'html' in d:\Customers\user1177213\www\file_test.php on line 1

    Warning: file(search_templatehtml): failed to open stream: No such file or directory in d:\Customers\user1177213\www\file_test.php on line 1

    Honestly, I'm not a PHP expert, and these notices and warnings don't give me much insight into the problem.

  4. #4
    Join Date
    Jan 2006
    Posts
    11

    Default

    David,

    Is this the link you meant?:
    http://answers.interland.com/display...RL=&r=0.193722

    I have accessed the administrative control panel of this account, and there is no "Edit Permissions" option and no "Account Functions drop-down list". But then we're on a different plan than is specified for that documentation. I certainly don't expect any help from Wrensoft resolving issues with Interland, but do these errors indicate a problem that must be addressed on the server? If I could narrow that down, at least, it would help guide my desisions for using Zoom and Interland on future projects. I really like Zoom, but Interland doesn't seem to offer the flexibility and administrative functions necessary to run it, or much else, using PHP. What do you think?

  5. #5
    Join Date
    Jan 2006
    Posts
    11

    Default

    I tried using my FTP program to change the permissions of search_template.html, but I got this error: "Error -142: remote chmod failed". There is no function I can find on the account's administrative control panel that would allow me to do this either. Everything is locked down tight.

    Ah but wait... I checked again, and this is baffling. Originally the file had an octal of 000, or no permissions. After reconnecting via FTP, the permissions are showing as 777! I am thoroughly confused.

  6. #6
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,156

    Default

    For some crazy reason it seems that the Interland FAQ pages are doing session management, so none of the Interland FAQ links above see to work.

    If you go to this page,
    http://answers.interland.com/
    and search for "fopen" you will find the articles I mentioned about.

    In particular the articles say,

    "The fopen() function is used to open a file or URL in PHP. This function is required for many tasks that our customers perform, such as payment processing, accessing text and images from remote sites, or other tasks that require the HTTP, HTTPS, or FTP protocols."

    "In the PHP versions that are installed on Interland servers, we have enabled allow_url_fopen"

    "PHP scripts do not have to reside in a particular directory and will run anywhere on your account, as long as the file permissions are correct."

    I also made a mistake in the example script above. It should have been,
    <?php
    $template = file ("search_template.html");
    ?>

    You could also try

    <?php
    $template = file ("d:\Customers\user1177213\www\search_template.htm l");
    ?>

    and

    <?php
    $template = file (".\search_template.html");
    ?>


    If this doesn't work I would contact Interland and ask why this simple 1 line script doesn't work.

    You should also ask them how you change file permissions on your server. (the common methods are using FTP or a Shell login in Linux).

    -----
    David

  7. #7
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,156

    Default

    In reference to your post about using FTP to change file permissions.

    FTP was a Unix tool originally and the FTP commands often assume you are connecting to a Unix / Linux machine. This means that many 3rd party FTP programs don't handle Windows server file permissions very well (or at all). It is a bit of a lucky dip. There is a discussion of the Windows permission issue here,
    http://www.xav.com/scripts/installer/3008.html

    ----
    David

  8. #8
    Join Date
    Jan 2006
    Posts
    11

    Default

    Thanks again David - you're being very helpful here.

    I've tried your latest suggestions. When I use "d:\Customers\user1177213\www\search_template.html " in the file function, I just get a blank page with no errors. All other methods result in:
    Warning: file(.\search_template.html): failed to open stream: No such file or directory in d:\Customers\user1177213\www\file_test3.php on line 1

    This seems profoundly wrong to me, even though I don't have a thorough understanding of the situation. I don't understand why the server would be throwing errors containing a local system path. It doesn't seem very secure or helpful.

    Also, I'm not sure why you mentioned the fopen() function, as it does not appear in the line throwing the original warning in search.php. Was that just for test purposes?

    I'm going to call Interland tomorrow. What specifically should I ask them? If I can't get this problem resolved tomorrow, I'm going to have to resort to a 3rd party site search service, unfortunately. But I'd rather get this working and use Zoom.

  9. #9
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,156

    Default

    A blank page means the script executed without error. (in other words the fopen command worked)

    Using fopen is almost the same as the file command. They should both work or both fail. So yes, it was just for testing.

    In theory the following 3 PHPs command should give the same result,
    $template = file ("search_template.html");
    $template = file ("d:\Customers\user1177213\www\search_template.htm l");
    $template = file (".\search_template.html");

    Becuase the 2nd command worked and the others didn't we can guess that the script is being run in directory A but is trying to open files in directory B. (and we don't know where B is on your server). In other words the current working directory (CWD) is set to a strange location.

    Could you try this PHP script to get & change the CWD.

    <?php
    echo "Display current directory\n";
    echo getcwd()."\n";
    chdir('d:\Customers\user1177213\www\');
    echo "After change directory\n";
    echo getcwd()."\n";
    $template = file ("search_template.html");
    ?>

    If you still get the failed to open stream message I would ask your hosting company why this small script above doesn't work.

    ----
    David

  10. #10
    Join Date
    Jan 2006
    Posts
    11

    Default

    I tried your new test script and got more errors, so I tried changing
    chdir('d:\Customers\user1177213\www\');
    to
    chdir('d:/Customers/user1177213/www/');
    because the backslash was escaping the second single quote. After I made that change, here's what the script returns:

    Display current directory C:\WINDOWS
    Warning: chdir(): No such file or directory (errno 2) in d:\Customers\user1177213\www\cwd_test.php on line 8
    After change directory C:\WINDOWS
    Warning: file(search_template.html): failed to open stream: No such file or directory in d:\Customers\user1177213\www\cwd_test.php on line 11


Similar Threads

  1. Logging problem, Failed to open stream permission denied
    By exousiapower in forum Zoom Search Engine V4 (Old Version)
    Replies: 11
    Last Post: 10-15-2007, 09:21 PM
  2. Warning: file(search_template.html): failed to open stream..
    By rndilger in forum Zoom Search Engine V4 (Old Version)
    Replies: 5
    Last Post: 06-12-2006, 01:14 AM
  3. changing search_template.html to an asp file ....
    By zain in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 04-19-2006, 11:41 PM
  4. search_template.asp instead of search_template.html
    By khan in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 07-25-2005, 10:58 PM
  5. Include File in Search_Template.html
    By jgoungo in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 01-27-2005, 04:00 AM

Posting Permissions

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