简体   繁体   English

使用www-data用户运行Laravel命令

[英]Run Laravel Commands with www-data user

I made a command in Laravel 5.1 that is supposed to delete some directories from the file system. 我在Laravel 5.1中发出了一个命令,它应该从文件系统中删除一些目录。

in the handle() method of the command class, i did shell_exec("whoami") and it returns raheel . 在命令类的handle()方法中,我做了shell_exec("whoami")并返回raheel However the user raheel has no permission on the specified directory. 但是,用户raheel对指定的目录没有权限。 I want to run this command as apache www-data user. 我想以apache www-data用户身份运行此命令。

How can i implement this in Laravel ? 我怎样才能在Laravel中实现这一点?

Thanks 谢谢

这就是我运行我的crons的方式:

su -c "php artisan schedule:run >> /dev/null 2>&1" -s /bin/sh www-data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM