I just installed nginx and php72 on openbsd server to setup an website. I have my website root directory in /var/www/html and want to access some XML files that I store in /var/cache/.
The problem is that that when I try check if file_exists(‘var/cache/file.xml’) it says that it does not exist, but it does!
And after some “debugging” and using of $_SERVER[‘DOCUMENT_ROOT’] says that the path were the root directory is: /www/html but the real path, on server, is /var/www/html so somehow PHP/NGINX can’t detect /var which I need since there is were I put my xml file.
Is there something I can enter in php.ini or php-fpm.conf to enable php to read this path?
Hope I did explain that correct for you and that you understand what I mean here.
I believe that it is because of the built-in chroot in nginx for OpenBSD.
Try starting nginx with the
-u flag. It will disable the chroot/jail and allow scripts running in nginx to access other paths on the file system.
From the documentation:
By default nginx will chroot(2) to the home directory of the user running the daemon, typically “www”, or to the home directory of user in nginx.conf. The -u option disables this behaviour, and returns nginx to the original “unsecure” behaviour.