Loading...
 
Skip to main content

PHP Safe Mode Fix

Status
Open
Subject
PHP Safe Mode Fix
Version
9.x
Category
  • Error
Feature
Installer (profiles, upgrades and server-related issues)
Resolution status
Out of Date
Submitted by
alien
Lastmod by
Ushindi Gedeon
Rating
(0)
Description

The install fails if the server is running php safe mode. There are several references to this issue with work-arounds that didn't work for me (ex. http://twbasics.tikiforsmarties.com/Fixing+Installation+Problems).

The problem (at least for me) was that I do not have access to /tmp. It turns out to be related to a bit of code in initlib.php that doesn't check for an empty tempdir. I added additional code return ./tmp (and create it if necessary). See below. Code is commented "Safemode Fix".

static function tempdir()
{
static $tempdir;
if (!$tempdir) {
$tempfile = @tempnam(false, '');
$tempdir = dirname($tempfile);
@unlink($tempfile);
__ // Safemode Fix
if (!$tempdir) {
$tempdir = "./tmp";
if (!is_dir($tempdir)) {
mkdir($tempdir);
}
}__

}
return $tempdir;
}

Solution
Workaround
Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
4319
Created
Monday 22 October, 2012 15:23:54 UTC
by alien
LastModif
Saturday 04 July, 2026 21:07:10 UTC


Show PHP error messages