freediver
freediver

Reputation: 309

PHP exec enabled?

exec() appears to be enabled on the server (function_exists('exec') returns true, and command is not listed in 'disable_functions' variable) yet we get

Warning: exec() has been disabled for security reasons in ...

Any clues on how to detect this before calling?

EDIT:

It was suhosin blacklist and can be checked with following code

if (extension_loaded('suhosin')) { $suhosin = @ini_get("suhosin.executor.func.blacklist"); ...

Upvotes: 5

Views: 1983

Answers (3)

Michael D Price
Michael D Price

Reputation: 691

I answered this in another question page. Its not before the call, but that shouldn't matter. Here is my answer ;)

// This will check if the function actually works.('permissions, rights, ect ..')

if(@exec('echo EXEC') == 'EXEC'){
    echo 'exec works';
}

Upvotes: 0

freediver
freediver

Reputation: 309

It was suhosin blacklist and can be checked with following code

if (extension_loaded('suhosin')) { $suhosin = @ini_get("suhosin.executor.func.blacklist"); ..

Upvotes: 0

k102
k102

Reputation: 8079

as written in the manual for the safe mode: You can only execute executables within the safe_mode_exec_dir.

Upvotes: 3

Related Questions