Sorry, I'm new to Symfony.
I think I've tried everything here. I'm trying to install a Symfony v2.8 application on a new machine. When I'm trying to access the application I'm getting exceptions stating lack of permissions to access either cache or logs directory. Cache and logs directories are writeable though - mask 777 set for both.
Also there seems to be a process that creates entries in the cache directory as it fills in with files. The problem seems to be that the web server can't access them - but why?
getfacl for both cache and logs directories returns this:
# owner: apache
# group: apache
user::rwx
user:apache:rwx
group::rwx
mask::rwx
other::rwx
default:user::rwx
default:user:apache:rwx
default:group::rwx
default:mask::rwx
default:other::rwx
Any suggestions would be greatly appreciated. Thanks!
Check that you logs and cache are being put in the correct location. Symfony has "two" major development environments (dev and prod). They (env) write logs and caches in two separate folders. Check the getCacheDir() and getLogDir() methods in the app/AppKernel.php.
Related
Symfony 2.8
Apache 2.4
Deployer 3.3
Apache user: www-data
Currently the assets directory where images get uploaded is under the Symfony web directory: /var/www/html/project/current/web/assets/items.
When I deploy new versions using Deployer I have to move all of the images into the new assets directory. Although not a big task at the moment (there are 16,000+ images), as we grow this will likely cause issues. Furthermore since the current directory in the path is a symbolic link, it seems that apache/php keeps the old location in memory and serves data from it meaning that requests for those images generate 404 errors.
Moving this directory to another location (and even another hard drive) would solve these annoyances. I don't feel that I have the experience to do this safely without first consulting some best practices. I'm sure I could figure out how to add an Alias in the apache configuration, but I'm concerned about security and how things will operate with Symfony.
My question then is where should the assets directory go in the filesystem with what permissions and what Apache configuration should be applied so that Symfony will not be affected negatively?
Thanks
You can add your assets directory to "shared_dirs" variable, which is used to keep your shared/common files and directories between releases. In this case your assets directory will be stored in /var/www/html/project/shared folder and symlinked to each release.
set('shared_dirs', [
'app/sessions',
'app/logs',
'web/assets/items',
]);
As for Apache symlink issue, please try to reload Apache server's configuration within deployment process.
// Reload Apache configuration to avoid symlink issue
task('apache:reload', function () {
run('sudo /etc/init.d/apache2 reload');
})->desc('Reload Apache configuration');
after('cleanup', 'apache:reload');
I've recently been tasked with moving a client out of a shared hosting environment into an AWS environment where all the infrastructure was hosted and supplied by Amazon. The client is running multiple (dated) Drupal instances, but luckily I've been able to move the environment over and have it function, except for the errors below.
I've discovered that Drupal is generating errors throughout their environment(s) on the AWS instance, but not on the shared hosting instance, despite using the same except code base/database.
Permission Error(s): http://i.imgur.com/cRQOo4W.jpg
Timezone Error(s): http://i.imgur.com/VFgWZKE.jpg
Personally, I'm not a big Drupal guy and I've researched the file permissions on the root directories (https://www.drupal.org/node/244924), but I honestly do not want to go around changing things without fully knowing the effect of a change.
If anyone can provide insight to the root of these errors and how I can potential resolve them, I would greatly appreciate it.
P.S. - Most of the environments in question are running on Drupal 6.33 (not 100% sure), but they do have one environment running on Drupal 7.23 (again, not 100% sure).
Make sure the web server's user/group owns the Drupal files, not root. Then follow the file permission instructions in INSTALL.txt.
Select a timezone in the Regional Settings of your Drupal site on AWS. If that doesn't do it, set the date.timezone in the php.ini file there.
I'm working on a Symfony2 project at local server without any virtual hosting or something else. After I run the command php app/console assets:install --symlink, clear the cache and refresh the page none styles or javascript or images are loaded. Inspecting the source code and trying to access any of those assets I get this error:
You don't have permission to access
/cmplatform/web/bundles/clanmovilcommon/css/bootstrap.min.css on this
server.
What I need to change in my /etc/httpd/conf/httpd.conf to fix that problem? It's related to .htaccess problem or what?
This error is due to the user that you are currently logged in as not having correct to write to the /cmplatform/web directory. Or you have not got the root path set correctly in your apache.conf.
Can you confirm other pages / assets are being served correctly.
Take a look at who owns the directory and either adjust the write permissions or add your user / web server to own the directory or into the group.
This is quite a common issue - and care needs to be taken to ensure that write permissions for web, cache and log directories are set correctly to allow command line and web server (e.g. apache / nginx) users.
See http://symfony.com/doc/current/book/installation.html - permissions for some tips about fixing this.
I'm trying to evaluate Symfony 2 (2.1.7). I'm installing it following the download instructions on an EC2 instance that is already running PHP 5.3.20 on Apache.
I'm stuck on the second step of the README.md: "Access the config.php script from a browser". The readme assumes a local installation and provides a sample URL to the localhost: http://localhost/path/to/symfony/app/web/config.php.
Since I'm on a remote server, I try to access the config.php file using the relevant URL: http://mysite.com/Symfony/app/check.php, which returns this message:
Forbidden
You don't have permission to access /Symfony/app/check.php on this server.
I tried to apply the answer from How do I access to symfony config.php remotely? by adding what PHP reports back as my REMOTE_ADDR, but that doesn't change the message.
What do I do now?
In symfony, the web folder is supposed to be your webroot. So, if you want to access \project\web\config.php, you should point your browser to http://www.example.com/config.php.
If that doesnt work, apache is probably configured incorrectly. make sure it it is pointed at your web directory, not your project directory.
edit As you mention in your question, you will also need to edit the config.php file to allow remote access. You can comment those lines out, or add your IP to the whitelist.
edit2 Many webhosts don't allow you to specify your webroot. In that situation, you can put the Symfony files in a different directory and create a symlink between the Symfony web directory and your webroot.
Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he runs the nginx and php-fpm servers (example "sudo_user"). But the trouble is for example I have "some_user" and he has a directory of his web-site "some_user/www.some_user.com" with all the configuration files, including database passwords and so on. I set ownership of all files to some_user:some_user (user:group) and changed permissions to all files 751 (u=rwx,g=rx,o=x so other accounts cant just go in this dir and read every config file) and set to public files permission 755. But my php-fpm runs with "sudo_user" with a group "sudo_user" he don't have a permission to write or read config files in "some_user" directory. What strategy should I take?
Its probably better to create an nginx user and nginx group, and have nginx/php run under that user. Then you can add the user nginx to your some_user/sudo_user's groups with your 751 permissions and you should be set.