[Typo3-install] Safe mode problem and patch
Mads Gorm Larsen
madsgormlarsen at gmail.com
Sun Oct 23 01:33:38 CEST 2005
HI
I for some time ago treid out typo3 and ran into a safe mode problem,
and I made a rather simple patch, and wrote about it in this list. I
would like to know if the safe mode problem has been solved in recent
versions of typo3, of i somebody else has made a better patch?
Here is a litle bit of the old tread.
>>
1. One example on the problem is the following
(http://typo3.org/documentation/mailing-lists/install-general-archive/
thread
/110097736/?tx_maillisttofaq_pi1%5Bmode%5D=1 )
²After installing Typo3 3.7.0 and creating db etc I went to the backend
to
log in. But when I do I get this error : "Warning: fopen(): SAFE MODE
Restriction in effect. The script whose uid/gid is 117345/117345 is not
allowed to access /hsphere/local/home/thagel/legah.se/typo3temp/llxml
owned
by uid/gid 398/398 in
/hsphere/local/home/thagel/legah.se/typo3/t3lib/class.t3lib_div.php on
line
2020²
Execelent solution described by mr_oldschoolbreaker
² I myself have very little knowledge of server administration or php,
but
due to the pure need managed to find a workaround for one of the most
annoying problems which are based on the use of safemode:
<b>simple explanation:</b>
The Folder .../typo3temp/llxml was made by a typo3 script and therefor
got
another UID then any other folder or file that you uploaded via FTP to
your
website. Safemode does only allow scripts to access files/folders with
the
same UID
<b>My dummy work around:</b>
Use FTP Client to download the folders/files made by Typo3 script (in
the
installation case Folders "llxml" and then "cs") to your local hard
disk,
detlete them on server and then upload them again. Voila! Now those new
Folders have the same UID as the uploaded scripts and safemode doesn't
find
anything to complain about. I use that workaround also with my
webgallery
(4images) whenever it creates a new category folder.
<b>A more elegant way</b>
As far as i read, it should also be possible to change all UIDs via a
console command, but being a dummy user i don't know how to use a
console on
a server i only have limited access, too - let aside the syntax of the
command...maybe someone more experienced can add that info?²
What safe-mode problems do you have?
TYPO3 doesn't need a patch because safe-mode is detected automatically.
File
manager, etc. should work fine even with safe_mode installed.
About installation: You do not need the symlinks but be aware that this
is
more complicated to make upgrades etc.
You can always work around this but if you can't live with that you
should
ask your ISP to do the installation incl. symlinks for you or otherwise
consider to change the ISP.
2. Another example on the problem is when installing through the
extension
manager, I get the following error
³Warning: mkdir(): SAFE MODE Restriction in effect. The script whose
uid/gid
is 125381/125381 is not allowed to access
/hsphere/local/home/madsgorm/madsgormlarsen.dk/testsite/typo3conf/ext/
doc_tu
t_templselect owned by uid/gid 398/398 in
/hsphere/local/home/madsgorm/madsgormlarsen.dk/testsite/typo3/t3lib/
class.t3
lib_div.php on line 2089
Error: The directory
"/hsphere/local/home/madsgorm/madsgormlarsen.dk/testsite/typo3conf/ext/
doc_t
ut_templselect/part1/" could not be created...²
Here mr_oldschoolbreaker does unfortunately not work, if you make the
folders before trying to upload extensions typo3 will simply change
permissions, and user and group so you end up with the same error.
// create directory through FTP connection in typo3 localconf
// Thanks to Han Van den Hoof for help found on PHP.net under function
mkdir
// Safe mode problem in typo3 - you need my bad ass FTP hack baby;-)
// Made by Mads Gorm Larsen
function mkdir($theNewFolder) {
$theNewFolder = ereg_replace('\/$','',$theNewFolder);
//echo "<br>To find out what how the number must be changed you need to
see this string $theNewFolder";
$Array_Name = explode("/", $theNewFolder);
for ($counter=1; $counter<6; $counter++){ // THIS NUMBER MUST BE
CHANGED - removes elements
array_shift($Array_Name);
}
array_unshift($Array_Name, "");//puts an empty element to the begining,
witch will later be made to a /
$newDir = end($Array_Name);
array_pop($Array_Name);//removes last element, så we have path without
name of new directory
$path = implode("/", $Array_Name);
$server='ws9.surftown.dk'; // ftp server
$connection = ftp_connect($server); // connection
// login to ftp server
$user = "madsgorm";
$pass = "66176315";
$result = ftp_login($connection, $user, $pass);
// check if connection was made
if ((!$connection) || (!$result)) {
return false;
echo "No, connection to server";
exit();
} else {
ftp_chdir($connection, $path); // go to destination dir
umask(000);//this might not be at good idea
ftp_mkdir($connection,$newDir);
$chmod_cmd="CHMOD
".$GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']." ".$newDir;
//remember to change this in localconf to for exsample 0777
umask(000);//this might not be a good idea
$chmod=ftp_site($connection, $chmod_cmd);
return $true;
ftp_close($connection); // close connection
}
}
<<<
Med venlig hilsen
Mads Gorm Larsen
______________________________________________________________________
Tlf: 66 11 66 13
Mobil: 27 40 17 01
Mads Gorm Larsen
Odensevej 54
5400 Bogense
E-mail: madsgormlarsen at gmail.com
_______________________________________________________________________
More information about the TYPO3-install
mailing list