Cmag
Cmag

Reputation: 15770

php not able to execute system commands

For some reason, the following php script when called via apache, is not returning results... is there a system security setting in php.ini somewhere to allow system commands?

<div style="background:#000;color:#fff">
<?php

   $cmd = "/bin/date";
   $output = system($cmd);
   printf("System Output: $output\n");
   exec($cmd, $results);
   printf("Exec Output: {$results[0]}\n");
   echo"<pre>";
   echo system('/bin/ls');
   echo"</pre>";
   ?>
   </div>

Upvotes: 0

Views: 3372

Answers (2)

Cmag
Cmag

Reputation: 15770

plesk safe mode... disabled in httpd.include... sigh... love it when systems land in your lap

Upvotes: 0

genesis
genesis

Reputation: 50982

Your host (or configuration) is probably restricting system() or exec() command. Check your configuration or contact your host

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions =

should be blank, works on my machine

http://sandbox.phpcode.eu/g/e47f7

Also, check that SElinux and Suhoshin is configured properly

Upvotes: 1

Related Questions