Tuesday, September 17, 2013

Re: Please help Safe Mode PHP server problems

Can't you disable safe_mode?

It has been deprecated on php  5.3 and is removed from php 5.4 since it was not "correct" and generated more pain than security.
http://www.php.net/manual/en/features.safe-mode.php

A well chosen open_basedir is a good alternative to safe mode.


--
[]'s

Breno Damas M. Ribeiro
+[Web] Developer
+http://ribeirobreno.com.br/

"E eu com essa dor terrível nos diodos esquerdos." - Marvin


On Tue, Sep 17, 2013 at 9:55 AM, Miloš Vučinić <milosvucinic@gmail.com> wrote:
Oh and one more thing. When I delete the line set_time_limit(0);, the error stays the same


On Tuesday, September 17, 2013 2:33:59 PM UTC+2, Miloš Vučinić wrote:
Hey guys, 

I am not usually asking for help, but this time I am desperate. I am running a Cake PHP app on a safe mode php server. And when I try to download a file using media view i get error Cannot set time limit in safe mode [CORE/Cake/Network/CakeResponse.php, line 1303 . 
So I delete that line just to see what will happen (maybe it can work without it or smth) upload the code and I get the same error, as if I haven't changed the code in /Cake/Network/CakeResponse.php . Then I thought I am editing the wrong files so I add a few echos and it works .. I am so confused...

The full error is here : 
Warning (2): set_time_limit(): Cannot set time limit in safe mode [CORE/Cake/Network/CakeResponse.php, line 1303]Code Context

set_time_limit - [internal], line ??
CakeResponse::_sendFile() - CORE/Cake/Network/CakeResponse.php, line 1303
CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 415
MediaView::render() - CORE/Cake/View/MediaView.php, line 98
Controller::render() - CORE/Cake/Controller/Controller.php, line 948
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 194
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162

even tho the new function looks like this: 
/**
 * Reads out a file, and echos the content to the client.
 *
 * @param File $file File object
 * @return boolean True is whole file is echoed successfully or false if client connection is lost in between
 */
protected function _sendFile($file) {
$compress = $this->outputCompressed();
$file->open('rb');
while (!feof($file->handle)) {
if (!$this->_isActive()) {
$file->close();
return false;
}
set_time_limit(0);
echo fread($file->handle, 8192);
if (!$compress) {
$this->_flushBuffer();
}
}
$file->close();
return true;
}


Is it possible that CakePHP cant be run under safe mode servers ? 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: