0

I have symfony task call "doNothing" and i want to execute it from executing shell_exec('/var/www/esm/symfony php symfony doNothing');

by calling to my symfony action

apache error saying permission denied.

i think www-data user dont have permission how could i resolved this?

Edited

error is

sh: /var/www/esm/symfony: permission denied

Roshan Wijesena
  • 3,106
  • 8
  • 38
  • 57

1 Answers1

2

You should look in the directory where your script is.

Use ls -la to show all files in the folder and their permissions (to execute php script file must have at least x bit assigned to www-data or its group).

Also all the parent directories up to / MUST have x bit assigned to user/group for apache to be able to change directory to.

Look. You have Tree structured Files system:

  • /var/www is in /var
  • /var/www/esm is in /var/www
  • /var/www/esm/symfony is in /var/www/esm

So www-data user should have the ability to Execute (x bit) all of that directories.

So when in / execute ls -l and look wheter /var has x bit for www-data user or it's group (drwxrwx---) and it owns this directory. When in /var execute ls -l an so on...

You can change permissions to 777 for every directory. But DO NOT use -R key. Just change permissions to the directory only.

s.webbandit
  • 16,332
  • 16
  • 58
  • 82