0

This works, so exec function is not disabled.

exec('ls');

This doesn't work even thought script.php has 777 chmod.

exec('php script.php');

This doesn't work either.

exec('php -v');

I tried to chmod and chown /var/www/ folder, but it doesn't help. I suppose this is due to the www-data user permissions, looks like it doesn't have access to several bin files.

How can I solve this?

Andrei Canta
  • 444
  • 3
  • 15

2 Answers2

1

try

which php 

and then get the path and put it in exec() like

exec("/opt/local/bin/php -v");
Meabed
  • 3,828
  • 1
  • 27
  • 37
-2

try php -f script.php

Im not 100% sure this is correct, but i've always sent the -f flag when passing in a file.

Applehat
  • 668
  • 4
  • 12