Re: Running php cli when php-fpm uses chroot

2019-04-14 Thread Joel Carnat
On Fri 12/04 15:37, Éric Jacquot wrote:
> Hi,
> 
> Le Friday 12 April 2019 à 11:53 +0200, Joel Carnat a écrit :
> > Hi,
> > 
> > Is there a better way to handle chroot environnement when running php
> > scripts from the cli?
> > 
> 
> According to pkg-readme (/usr/local/share/doc/pkg-readmes/nextcloud) 
> 
> A symlink can be created to workaround this issue:
> # ln -sf /var/www/nextcloud /nextcloud  
> 

That doesn't seem to work as-is. But... I have installed NC manually and
not using ports. Anyway, the pkg-readmes note confirms that it's the way
to go.

Thanks.



Re: Running php cli when php-fpm uses chroot

2019-04-12 Thread Stuart Henderson
On 2019-04-12, Joel Carnat  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.