Over a million developers have joined DZone.

Check if PHP is running in safe mode or not

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Lately, I have been playing around with PHP configuration. And I realized that the runtime configurations do not change using ini_set function, if you are running PHP in the safe mode.  A simple check in PHP can tell you this. Notice the code block below and which allows to check this.

<?php
// Check for safe mode
if( ini_get('safe_mode') )
{
  //don't do anything
}else
{
  //change the maximum execution time of
  //a script from 30 seconds to 300 secs
  ini_set('max_execution_time',300);
}
 
?>

Next, time when you are going to change any configuration at runtime, I am sure you want to check this, before you could see that change working.

Hope that helps.

Stay digified !!

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Published at DZone with permission of Sachin Khosla, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}