Hi, I’d really like to try out grab but am running into a number of problems. I’m running on a linode running Ubuntu 14.04.1 with nginx and php-fpm.
I first tried to install from the zip file. After changing ownership of all the files to the web server (www-data in my case), the grav install is reachable by a browser. However, bin/gpm doesn’t work. I was getting permissions errors (presumably because when run by my user, it couldn’t write in the log directory). So I chowned all the files to have my group as the group owner and chmoded everything g+w. Then when I ran bin/gpm, I got the following:
Whoops\Exception\ErrorException: fopen(/www-root/mydomain.tld/grav/cache/compiled/blueprints/master-loc alhost.php): failed to open stream: Permission denied in file /data/public_html/mydomain.tld/grav/vendor/rockettheme/toolbox/File/sr c/File.php on line 149
Stack trace:
1. Whoops\Exception\ErrorException->() /www-root/mydomain.tld/grav/vendor/rockettheme/toolbox/File/src/File.p hp:149
2. Whoops\Run->handleError() :0
3. fopen() /www-root/mydomain.tld/grav/vendo r/rockettheme/toolbox/File/src/File.p hp:149
4. RocketTheme\Toolbox\File\File->lock() /www-root/mydomain.tld/grav/system/src/Grav/Common/Config/Config.php:2 38
5. Grav\Common\Config\Config->loadCompiledBlueprints() /www-root/mydomain.tld/grav/system/src/Grav/Common/Config/Config.php:1 69
6. Grav\Common\Config\Config->init() /www-root/mydomain.tld/grav/bin/gpm:30
At this point, I gave up with the zip file and tried the git install method. Once I tweaked permissions as above, I got a bit farther along, though when I ran bin/gpm index, I got the following error:
[Whoops\Exception\ErrorException]
Use of undefined constant CURLOPT_REFERER - assumed 'CURLOPT_REFERER'
Any ideas what I am doing wrong here? I do think it would be helpful for some guidelines for how permissions should be set.
With any PHP application that writes files (logs, cache, etc), permissions can be a problem. This is because PHP running under apache can be a different user from the user logged in and running via CLI. You probably already know this, just repeating for clarity.
On most local installs, and even most shared hosting setups, this is not a problem because both are configured to run with the same user. However, in a dedicated server environment this is usually not the case.
The best solution I can suggest is ensure your user and your webserver are in the same group, then ensure the file & folder permissions are set with that group and that group has read+write permissions on the files folders.
Here’s a little script I have used in the past when facing this situation:
Thanks for the quick reply and specifics on the permissions. I think I had reached a similar solution, but seeing the official approach is always nice.
Oh! One other option to address your permissions issue.
If this Ubuntu install is your local development environment, then an easier/better solution might be to configure apache to run as your regular user account. I do this for Apache on Mac OS X: