Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9696

Installation of phpBB with SQLite fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.0.8-RC1
    • 3.0.7-PL1
    • Installation system
    • None
    • PHP 5.3.2, Apache 2.2.15, Linux (Arch Linux), Firefox 3.6.6

      During installation phpBB stops with the error:

      [phpBB Debug] PHP Notice: in file /includes/functions.php on line 1041: is_dir(): open_basedir restriction in effect. File(/home/user/db/forum.db/) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/)

      The reason seems to be less a wrong database server hostname but the (unforeseen) behaviour of is_dir() in PHP 5.3.2 (probably also other versions).
      Let me explain the problem. If I load the following PHP script in my browser

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      if (is_dir("/home/user/A/")) print "ok";
      if (is_dir("/home/user/B/")) print "ok";
      ?>
      

      and I do have a directory A and a file B, then the is_dir() check for B will throw the warning (which in the case of phpBB breaks the installation procedure).
      It does not fail if B doesn't exist or if I remove the trailing slash from the name. Also, for a directory like A there is never a problem. And the problem only occurs, of course, if the error reporting and displaying is switched on like above.
      In my case, the argument to is_dir() is the SQLite database file and phpBB has the error reporting on, so it breaks.

      To me it seems that the behaviour of is_dir() is strange, because the warning makes no sense (we are always inside the restricted paths set by open_basedir) and I should file a bug report to the PHP people. Google tells me that this issue has occured already a while ago and has probably been fixed, while it now re-occurs again. But to me it would also make sense to adapt the phpBB code such that no matter which version of PHP I use the problem doesn't appear anymore. This is why I filed this bug report.

      I propose to change line 1041 in file includes/functions.php from

      	if (!@file_exists($resolved) || (!is_dir($resolved . '/') && !is_file($resolved)))
      

      to

      	if (!@file_exists($resolved) || (!@is_dir($resolved . '/') && !is_file($resolved)))
      

      Regards,
      Jens Vollinga

            bantu Andreas Fischer [X] (Inactive)
            vollinga vollinga
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: