I think that it's a permissions problem, because in my script
there are some commands that need root privileges to execute
I added www-data to sudoers hoping it would solve the problem
and did
exec("echo \"passwd\" | sudo -S ./myscript");
in my php but it didn't work.
Thanks