Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php replacement for safe_mode

Tags:

php

curl

i am new to learning PHP and so I've installed the latest version (5.3.3) and am writing some code. i have run across this error:

PHP Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in C:\Rush\dev\personal\Numina.Framework\Development\PHP Library\Numina.Framework\clsHttpUtil.php on line 47

When I look up the documentation for safe_mode it tells me that it is deprecated. why was it deprecated and what can i do to fix this error?

like image 984
Rush Frisby Avatar asked Oct 14 '22 02:10

Rush Frisby


1 Answers

safe_mode had good intentions, but was implemented unevenly. It was deprecated because it caused more problems than it solved, and was not a general security solution. There are better ways to achieve application environment protection now (like FastCGI, suexec, chroots, jails, VPSes...)

You can fix your error by turning safe_mode off, and design your code not to assume that it's being used or disused. Please note that safe_mode has been removed as of PHP 5.4.0.


Here's more information on why CURLOPT_FOLLOWLOCATION was disabled when safe_mode or open_basedir are in effect. Problems like this are one of the main reasons why safe_mode is likely to be removed from PHP entirely.

like image 151
Charles Avatar answered Nov 03 '22 04:11

Charles