I am still learning PHP and experimenting with code. I read that the following code should print “Goodbye” and “Sleeping…” but that it should NOT print “Done!” However, when it executes on my server (a hosted web space), it prints all 3:
<?php
function say_goodbye() {
print "Goodbye!<br>";
}
register_shutdown_function("say_goodbye");
set_time_limit(1);
print "Sleeping...<br>";
sleep(2);
print "Done!";
?>
Sleeping...
Done!
Goodbye!
According to the PHP documentation, set_time_limit() has no effect when SAFE MODE is enabled on the server, which would explain why all 3 print statements above display in the browser window:
http://php.net/manual/en/function.set-time-limit.php
And when I run phpinfo() on my server and view the content in-browser, within the Configure Command section it says:
‘–enable-safe-mode’
All this indicates that SAFE MODE is indeed ENABLED on my server (Apache).
However, there is something strange going on. According to the PHP manual on “Security & Safe Mode”, the following code should result in an error on my server if Safe Mode is Enabled:
<?php
echo '<pre>';
readfile('/etc/passwd');
echo '</pre>';
?>
But in fact, the above code displays the full list of logins, such as:
root:x:0:0:root:/root:/bin/bash
and my own login, and everyone else registered on the server!
My server is running PHP version 5.3.27, if that matters.
I would appreciate hearing your thoughts.
Thanks,
James Wages
dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options