baseurl.php not being included in settings.php (because of cwd?)

Bug #665732 reported by Chemtox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
drupal6 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: drupal6

Hola.

In my vanilla Ubuntu Lucid Lynx, baseurl.php is never read from the original settings.php on the default site. On writing a little debug code:

$fh = fopen('/tmp/log', 'a') or die("Can't open log file.");
if (file_exists('baseurl.php'))
 include_once('baseurl.php');
else
 fwrite($fh, "File not found at '". getcwd() ."'.\n");

fclose($fh);

and doing a 'tail -f /tmp/log', I always get "File not found at '/usr/share/drupal6'." PHP's CWD is pointing at Drupal's index.php, which makes sense, and file_exists fails while checking there. Copying baseurl.php to /usr/share/drupal6 or writing an absolute path did got it working (though as a work around, uncommenting $base_url in settings.php is easier of course).

I'm not sure if this is a PHP quirk, since I could not find any mentions of this problem, so I'd expect baseurl.php is working for most people, but this comment on the PHP reference seems to confirm this behavior as standard: 'Be aware: If you pass a relative path to file_exists, it will return false unless the path happens to be relative to the "current PHP dir".' [http://php.net/manual/en/function.file-exists.php] So includes do work in the current directory, but file_exists requires a chdir.

Perhaps this should happen all the way back to 4.7.4-2 ("Fix(ed) warning if baseurl.php does not exists"), but PHPs tricks kept it hidden until recent versions?

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: drupal6 6.18-1ubuntu1 [modified: usr/share/drupal6/includes/file.inc]
ProcVersionSignature: Ubuntu 2.6.32-24.43-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic x86_64
Architecture: amd64
Date: Sun Oct 24 00:13:58 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=
 PATH=(custom, user)
 LANG=es_MX.UTF-8
 SHELL=/bin/bash
SourcePackage: drupal6

Revision history for this message
Chemtox (chemtox) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.