I am trying to generate a bundle from a controller. But I am having permission denied error. And I can't figure out why.
Here is my controller code:
$app = new \Symfony\Bundle\FrameworkBundle\Console\Application($this->get("kernel"));
$app->setAutoExit(false);
$input = new \Symfony\Component\Console\Input\ArrayInput(array(
"command"=>"generate:bundle",
"--namespace"=>"testNewAnBundle",
"-n"=>""
));
$out = new \Symfony\Component\Console\Output\BufferedOutput();
$app->run($input, $out);
return new Response("<body>".$out->fetch()."</body>");
The output is:
Bundle generation > Generating a sample bundle skeleton into app/../src/testNewAnBundle [Symfony\Component\Debug\Exception\ContextErrorException] Warning: mkdir(): Permission denied generate:bundle [--namespace NAMESPACE] [--dir DIR] [--bundle-name BUNDLE-NAME] [--format FORMAT] [--shared] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--]
This create the folder testNewAnBundle/ in src/ and the folder testNewAnBundle/ has testNewAnBundle.php and Controller/DefaultController.php files generated.
The path testNewAnBundle/* permision is:
drwxrwxrwx+ www-data www-data testNewAnBundle
drwxrwxrwx+ 2 www-data www-data 4096 mai 14 16:13 Controller
-rw-rw-rw- 1 www-data www-data 125 mai 14 16:13 testNewAnBundle.php
May be you have to use ACL command line in user mode (not root)
HTTPDUSER= ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\\ -f1
ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\\ -f1
sudo setfacl -R -mu:"$HTTPDUSER":rwX -mu: whoami
:rwX var
sudo setfacl -dR -mu:"$HTTPDUSER":rwX -mu: whoami
:rwX var
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.