How to list disabled functions in PHP

I have a web client that had some really odd problems with a program of mine randomly logging him out. Normally I upload a phpinfo file and use that to see if I could find out anything but when I did that I got an error that phpinfo had been disabled for security purposes.

What I really needed was a list of what other functions had been disabled, so I put together the short script below to pull the list of disabled functions, sort them, and then echo them out. Of course if ini_get has been disabled then I might be in trouble and have to actually ask the host for the list.

PHP:
  1. <?php
  2. $disabled_functions = ini_get('disable_functions');
  3. if ($disabled_functions!='')
  4. {
  5. $arr = explode(',', $disabled_functions);
  6. sort($arr);
  7. echo 'Disabled functions:<br>';
  8. for ($i=0; $i<count($arr); $i++)
  9. {
  10. echo $i.' - '.$arr[$i].''<br>';
  11. }
  12. }
  13. else
  14. {
  15. echo 'No functions disabled';
  16. }
  17. ?>

There is another, shorter, version but it doesn't sort the list and the output is from a print_r command.

PHP:
  1. <?php
  2. $arr_disabled = ini_get('disabled_functions');
  3. print_r($arr_disabled);
  4. ?>

Either of these should give you the correct information, although the first is friendlier to look at.

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

Leave a Reply