On 2019-04-12, Joel Carnat <j...@carnat.net> wrote: > Hi, > > When php-fpm is configured to use chroot, it seems the php(1) cli still > tries to work unchrooted. So when running maintenance php scripts (like > occ from Nextcloud), errors raises for not finding resources (like mysql > socket etc). > > I couldn't find a option for the php(1) command to "run as chroot". > I didn't want to copy php(1) and its deps into the chroot directory. > > I could manage running the occ command by doing "dirty things": > # doas sh -c "ln -s /var/www/htdocs /htdocs && ln -s /var/www/run /run" > # doas -u www php occ db:convert-filecache-bigint > # doas sh -c "rm /htdocs /run" > > Is there a better way to handle chroot environnement when running php > scripts from the cli? > > Thanks. > >
I normally do mkdir /var/www/var ln -s .. /var/www/var/www and refer to full paths (including /var/www) inside the chroot. It doesn't strike me as being particularly dirty.