Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Show.php

Help
2009-02-13
2013-05-28
  • Colon Grease
    Colon Grease
    2009-02-13

    I just updated to 0.9.5, and now get this error on the Home screen:

    Warning: fopen(../swattlit/show.php?records=all&submit=Cite&showRows=5&citeOrder=creation-date&client=inc-refbase-1.0&wrapResults=0) [function.fopen]: failed to open stream: No such file or directory in /var/www/personal/swatt/refbase/includes/include.inc.php on line 5213

    swattlit is the directory where my literature is located, but not where the script show.php is located. Where is this specified, and how should I proceed to correct this error?

    The directory structure is set like this: URL/swatt/refbase is where refbase lives. URL/swatt/swattlit/ is where the literature lives.

    Thanks,
    Colin

     
    • Hi Colon,

      first, please make sure that the PHP directive 'allow_url_fopen' is set to "On" (or "1") in your active 'php.ini' file. See also:

      http://www.refbase.net/index.php/Required_PHP-INI_Settings

      Further more, make ensure that variable '$databaseBaseURL' in file 'initialize/ini.inc.php' has been set correctly.

      Are you using the default setting for variable '$databaseBaseURL'? Or did you modify its value? If so, how?

      Have you tried setting variable '$databaseBaseURL' to this:

      URL/swatt/refbase/

      Where URL is your server's full base URL. The entire URL should point to your server's refbase installation (and must end with a slash).

      Hope this helps, let us know if not.

      Matthias

       
    • Colon Grease
      Colon Grease
      2009-02-13

      Okay, I can change that. I guess it's just not very clear in the comments which URL should be for the literature files, i.e. URL/swatt/swattlit/, and which one should point to the refbase installation, /URL/swatt/refbase/.

      Well, after changing databaseURL to "" I get:

      Warning: fopen(show.php?records=all&submit=Cite&showRows=5&citeOrder=creation-date&client=inc-refbase-1.0&wrapResults=0) [function.fopen]: failed to open stream: No such file or directory in /var/www/personal/swatt/refbase/includes/include.inc.php on line 5213

      All the php settings are correct.

      The offensive line of code in include.inc.php is:

        5213                 $handle = fopen($sourceURL, "r"); // fetch data from URL in read mode

       
    • Variable '$databaseBaseURL' contains the URL to the refbase root directory where your refbase scripts are located.

      Have you tried the default setting for variable '$databaseBaseURL'? I.e. this:

      $databaseBaseURL = preg_replace('#[^/]*$#e','','http://'.$_SERVER['HTTP_HOST'].scriptURL(),1);

      Doesn't this work for you? If not, have you tried setting it to something like this:

      $databaseBaseURL = "http://refbase.textdriven.com/beta/";

      In the above example, replace "http://refbase.textdriven.com" with the URL to your server, and replace "/beta/" with the server path to your refbase installation ("/swatt/refbase/"). Have you actually tried this? If so, does it work now?

      In any case, you should *not* set it to an empty string.

      If "URL/swatt/swattlit/" points to your refbase file directory (which contains the uploaded PDF files etc), and if "swatt" is actually the first-level directory on your web server, then you'd use this:

      $filesBaseURL = "/swatt/swattlit/";

      If, instead, "personal" is the first-level directory, then you'd use:

      $filesBaseURL = "/personal/swatt/swattlit/";

      For '$filesBaseDir', you'd use (in both cases):

      $filesBaseDir = "/var/www/personal/swatt/swattlit/";

      I hope this helps.

      And please let us know if you've got some suggestions on how we could improve the wording in the descriptions of these variables.

      Thanks, Matthias

       
    • Colon Grease
      Colon Grease
      2009-02-17

      Thanks for the reply.

      When I use the default setting, I get the error below. As you can tell, I'm running this on the server console, but the result from the outside is the same. This looks like some sort of permissions issue.

      Warning: fopen(http://localhost:88/swatt/refbase/show.php?records=all&submit=Cite&showRows=5&citeOrder=creation-date&client=inc-refbase-1.0&wrapResults=0) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /var/www/personal/swatt/refbase/includes/include.inc.php on line 5213

      When I replace it with the URL, I get:

      Warning: fopen(<root URL, removed for privacy>/swatt/refbase/show.php?records=all&submit=Cite&showRows=5&citeOrder=creation-date&client=inc-refbase-1.0&wrapResults=0) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/personal/swatt/refbase/includes/include.inc.php on line 5213

      If it makes any difference, I'm running the web server on port 88, rather than 80.

       
    • Hi Colon,

      the default setting for variable '$databaseBaseURL' seems to work correctly since it points to the correct URL. At least the 404 Not Found error message is gone.

      What do you get if you copy and paste the URL from the first error message (in your previous post) into your browser?

      Note that the generated URL is just a regular HTTP URL, and if it can be accessed fine, it should produce some results similar to this one:

      http://beta.refbase.net/show.php?records=all&submit=Cite&showRows=5&citeOrder=creation-date&client=inc-refbase-1.0&wrapResults=0

      So do you get the same authorization error in your browser? Or does it produce some results in the browser?

      Does port 88 require some sort of authorization? If so, could you disable this temporarily on your localhost to see whether it would work then?

      In your second error message, you seem to have specified the server's URL, although you're still testing on localhost. If you're testing on localhost, and you want/need to hardcode the server URL, then you'd need to use "http://localhost:88/" as root URL. But, of course, you'd then need to adopt this setting when you move the scripts to the server. So it's generally better to use the default setting which has the advantage that the URL will also get generated correctly when you move your scripts to the server.

      There really isn't any magic with this variable. It's just used to generate full URLs like the 'show.php' URL. As mentioned above, you can always try the generated URL in your browser. If your browser can't find the actual script, then your setting is still wrong. That said, it looks as if the default setting works just fine (w.r.t. generating the correct URL) so I think you should stick with that.

      Matthias

       
    • Colon Grease
      Colon Grease
      2009-02-17

      So I run refbase from localhost (or on the server's internal router address 192.168.1.100:88 on a windows machine), and I get the first URL and the authentication error. If I copy and paste the URL in the error, it works the same as the one you pasted above. What gives? I'm willing to bet if I put the server on 80, it would work. Takers?

       
    • Colon Grease
      Colon Grease
      2009-02-17

      Oh wait. So there is authentication in the root http://URL/swatt/ directory via .htaccess, if that changes anything. Everything in the domain except the base directory http://URL/ requires authentication ...

      ... and yes, if I temporarily rename my .htaccess, it works. So now explain to me how to make this work with .htaccess!

      Thanks,
      Colin

       
    • Colon Grease
      Colon Grease
      2009-02-20

      *crickets chirping*

       
    • > if I temporarily rename my .htaccess, it works. So now
      > explain to me how to make this work with .htaccess!

      I'm sorry but I don't have a ready-made solution to that. I'm no Apache mod_rewrite wizard but others may be able to help you further.

      Alternatively, you could simply disable the display of the most recent publications on the main page -- or you could maybe use an AJAX-style method to include the results. AFAIK, the latter keeps the user's current session data. See the comments in 'index.php' above the call to function 'fetchDataFromURL()'.

      Matthias

       
    • Colon Grease
      Colon Grease
      2009-02-21

      Okay, thanks. How do I disable the front-page display? My users think it's broken :)

       
    • > How do I disable the front-page display?

      Search 'index.php' for this line:

      $recentAdditionsResultTable = fetchDataFromURL($recentAdditionsQueryURL);

      and comment it out, i.e. replace it with this:

      // $recentAdditionsResultTable = fetchDataFromURL($recentAdditionsQueryURL);

      HTH, Matthias

       
    • Colon Grease
      Colon Grease
      2009-02-25

      Okay, so now I cannot even add a record with .htaccess working, while with 0.9.0 it worked fine. What gives?

       
    • Colon Grease
      Colon Grease
      2009-02-25

      sorry, it was the group:user not being set to www-data:www-data. my bad.