This question might seem like all the other questions about the cache-problems.
I read all the other questions and their answers.
It didn't help or I didn't find the correct answer because this internet is full of the 'obvious' problem.
Following is here:
user#gobi:~$ app/console cache:clear --env=prod
root#gobi:~# setfacl -Rdm user:www-data:rwx /.../app/logs
root#gobi:~# setfacl -Rm user:www-data:rwx /.../app/logs
root#gobi:~# setfacl -Rdm user:www-data:rwx /.../app/cache/
root#gobi:~# setfacl -Rm user:www-data:rwx /.../app/cache/
website works
user#gobi:~$ app/console cache:clear --env=prod
website doesn't work (permission errors)
root#gobi:~# setfacl -Rdm user:www-data:rwx /.../app/logs
root#gobi:~# setfacl -Rm user:www-data:rwx /.../app/logs
root#gobi:~# setfacl -Rdm user:www-data:rwx /.../app/cache/
root#gobi:~# setfacl -Rm user:www-data:rwx /.../app/cache/
website works again
It seems that some files get permissions u:rw, go:- (/.../app/cache/prod/jms_diextra/controller_injectors) and others ug:rw, o:-
It seems the cache:clear overwrites my acl rights (user:www-data:rwx #effective:r--)
Anyone help?
Accoding to offcial installation docs, setting permission via facl is done like this:
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
Have you tried executing this?
Related
Basically I had my website created by a company, but they did not change it to prod - that is probably why another person can gain access to the website without any ftp info. I need to have this fixed.
I read on the net that there should be a few folders in my root file like dev and prod, but I see none. I have only one folder with a custom name that contains all the files. Could you guys let me know how to change it to prod that all the debug tools and stuff are blocked?
Run the following commands if you are on *nix type OS:
Step 1
Symfony 2
sudo rm -rf ./app/cache/*
sudo rm -rf ./app/logs/*
Symfony 3
sudo rm -rf ./var/cache/*
sudo rm -rf ./var/logs/*
Step 2
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx|lampp|xampp' | grep -v root | head -1 | cut -d\ -f1 PHPSTORMUSER=ps axo user,comm | grep -E 'storm' | grep -v root | head -1 | cut -d\ -f1`
Step 3
Symfony 2
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
Symfomy 3
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var/cache app/logs
Step 4
Symfony 2
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
Symfony 3
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var/cache var/logs
Step 5
export SYMFONY_ENV=prod
Step 6
composer install --no-dev --optimize-autoloader
These steps will remove all dev dependencies and will install prod dependencies according to composer.json config.
I followed the book of documentation to create my first page : http://symfony.com/doc/current/book/page_creation.html.
And I configured an Nginx web server for symfony according to :
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html#web-server-nginx
But all pages turned out to be an 404 error except the homepage.
Please help.
It turned out to be a permission problem...Just remove /var/cache /var/logs and /var/sessions, everything goes well.
This link:
http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
Describes how to setup permissions for your web server.
In particular, for Linux you would run:
$ 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`
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
I'm not sure if you are using MacOS, but there is a different set of commands as shown in the above link.
[Symfony\Component\Filesystem\Exception\IOException]
Failed to create "/var/www/html/.143986856455d2a694104cb": mkdir(): Permiss
ion denied.
I tried to execute new symfony project, how can I handle this?
Set permissions on app/logs and app/cache folders:
$ rm -rf app/cache/*
$ rm -rf app/logs/*
$ HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
$ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
You haven't the permission to write in the file or the folder.
For create a new project of symfony you need to do this.
sudo apt-get install curl
after that you downloading composer and symfony by this command
sudo curl -sS https://getcomposer.org/installer | php
and
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
you edit the permission of symfony.
sudo chmod a+x /usr/local/bin/symfony
and create the project
symfony new NameOfTheProject
like simple user not in root or using sudo.
you can also download the demo like that
symfony demo
i advise you to do this without the "[" , "]"
chmod -R 777 /var/www/html/[NameProjectHere]
;)
When deploying symfony2 to the web it still thinks im using local folders for instant..
[public]$ php app/console cache:clear --env=prod --no-debug
[RuntimeException]
Unable to write in the "C:/Users/brent.french/Documents/www/clients/app/app/cache/prod" directory
I tried following http://symfony.com/doc/current/cookbook/deployment-tools.html with no success any ideas?
FROM SSH :
USING ACL ON A SYSTEM SUPPORTING chmod +a
rm -rf app/cache/*
rm -rf app/logs/*
sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "yourname allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
USING ACL ON A SYSTEM NOT SUPPORTING chmod +a
sudo setfacl -R -m u:www-data:rwx -m u:yourname:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:yourname:rwx app/cache app/logs
Without using ACL
just after your opening PHP tag in : "app/console", "web/app.php" and "web/app_dev.php" add :
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777
Source : Symfony Doc
Deleted the app/cache/* folder to remove any old information and this fixed it.
I'm writing Symfony2-based sites on a Ubuntu 12.04 server, with the code itself hosted on a ZFS filesystem partition/zpool. However, the instructions on the Symfony 2 installation page for setting ACLs on the directories (app/logs & app/cache) do not apply, because ZFS does not support the chmod +a or setfacl commands.
Is there a ZFS-compatible version of the below commands?
sudo setfacl -Rn -m u:"$APACHEUSER":rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dRn -m u:"$APACHEUSER":rwX -m u:`whoami`:rwX app/cache app/logs
ZFS supports acls. You can set them using chmod A+, which looks something like:
chmod A+user:alister:add_file:allow /path/to/dir
Have a look at this article.
To mimic the setfacl commands, you'll at least need the following permissions:
read_data
write_data
add_file
add_subdirectory
delete_child
file_inherit
dir_inherit
The commands would look like this:
chmod A+user:`whoami`:read_data/write_data/add_file/add_subdirectory/delete_child:file_inherit/dir_inherit:allow app/cache app/logs
chmod A+user:"$APACHEUSER":read_data/write_data/add_file/add_subdirectory/delete_child:file_inherit/dir_inherit:allow app/cache app/logs
I've gathered this from the article I mentioned, but have no experience with ZFS, so you might need to tweak the commands a bit.