Вопрос

In my local machine I am used exec command as below :

 if($serverHost == "api.frapi") 
 {
     $phpBianryPath='/Applications/MAMP/bin/php/php5.4.10/bin/php';
 }
 else
 {
     $phpBianryPath='/usr/bin/php';
 }

 $logDir= dirname(__FILE__). '/BackgroundTask';                
 exec("$phpBianryPath $logDir/notificationCall.php $token >> $logDir/log_file.log 2>&1 &");

It works perfect in my local machine.But when I upload it on production server and then try to use it then it gives error as below:

sh: /var/www/html/example/src/frapi/custom/Action/BackgroundTask/log_file.log:
Permission denied

Please Guide me on this.I don't understand why it is not working in production?

Это было полезно?

Решение

You don't have the necessary rights to execute that file. If the server you're running the script has linux use the chmod command to change file permissions.

chmod 0764 /var/www/html/example/src/frapi/custom/Action/BackgroundTask/log_file.log

4 = read;

2 = write;

1 = execute;

read+write+execute = 4+2+1 = 7;

764 means rwx for owner, rx for group, r for others.

For further documentation please refer to: https://help.ubuntu.com/community/FilePermissions

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top