Friday, September 11, 2009

Does "Safe Mode" of PHP really give any benefit?


We had used ImageMagick tool for resizing the images without affecting quality in our BookMarklet project.

We implemented this project successfully in Client's server.

After few Months, client informed me that this tool is not working when they moved the code to another server.

After doing more analysis, I couldn't find any reason other than imageMagic installation in the new Server.

But the client confirmed that ImageMaigic was installed properly in their new server.


When I tried to show echo of "system (convert)", it didn't show any output.

So, I confirmed that the issue is with the ImageMagick usage only.

Here, convert is the executable file name for ImagaMagick tool. And, system is the php method for executing the executable files/system commands.

So, I informed the client about my findings. And, they were able to successfully use the ImageMagic without any issue after turning off the php Safe mode.

It is clear that Safe mode is preventing use of "system" method/function.

Refer this list to know the complete set of functions that are prevented by safe mode.

Php.net article/discussion is clearly saying that SafeMode is not having any use.

So, I am just wondering why some hosting companies are keeping php safe mode turn on by default.


More Articles...

No comments:

Search This Blog