[Typo3-debian] Virtual Domains

Steffen Mueller steffen at davis.kommwiss.fu-berlin.de
Mon Jan 26 04:38:30 CET 2004


hi michael and debian-list!

Michael Stucki schrieb:
> 
>>PHP Warning:
>>fopen("/var/www/foo.bar/typo3/ext/classic_welcome/ext_tables.php", "w")
>>- Permission denied in
>>/var/lib/typo3/typo3_src-3.5.0/t3lib/class.t3lib_div.php on line 1239
> 
> 
>>so please, do not change the filepermissions. just leave a warning
>>message, that multihosting can cause troubles.
> 
> 
> Maybe you're right but such problems should not occur if everything went
> right.
> 
> I tried to reproduce your example but didn't get any errors. Can you help me
> to manage that? :-)
>

do you have php error-logging configured to prompt for warning messages?

in php.ini, section: Error handling and logging

error_reporting  =  E_ALL & ~E_NOTICE


> Anyway. If such errors appear there must be bugs behind, cause TYPO3 is
> designed to run with a read-only source. So let's find&fix these bugs and
> make the change when it's done.
> 

the php warning refers to class.t3lib_div.php, function writeFile(), 
line 1235-1245:

/**
* Writes $content to the file $file
*/
function writeFile($file,$content)      {
    if($fd = fopen($file,"w"))      {
       fwrite( $fd, $content);
       fclose( $fd );
       if (@is_file($file) && TYPO3_OS!="WIN") {@chmod ($file, 0644);}
       return true;
    }
}


writeFile() simply does not check file-permissions, before opening the 
filehandle to write. fopen() triggers that warning, if php does not have 
write permission.
is_writeable() helps us to avoid warning messages in future. So this is 
the bugfixed version:


/**
* Writes $content to the file $file
*/
function writeFile($file,$content)      {
         if (is_writable($file)) {
                 if($fd = fopen($file,"w"))      {
                         fwrite( $fd, $content);
                         fclose( $fd );
                         if (@is_file($file) && TYPO3_OS!="WIN") {@chmod 
($file, 0644);}
                         return true;
                 }
         }
         else {
                 // Return a "writing to file is not permitted" warning.
                 // Code missing.
        }
}



The error handling must be done by anyone else. I'm not very familiar 
with the typo3 code.

so long, i hope this helps.
maybe we should discuss this on Typo3-dev before we fill a bugreport. it 
could be fixed in 3.6rc1.

-- 
cheers,
Steffen

----------------------------------------------------------
"Education is man's going forward from cocksure ignorance
to thoughtful uncertainty." (Don Clarks' Scrapbook)
----------------------------------------------------------




More information about the TYPO3-debian mailing list