Search code examples
phplinuxapachefastcgibrowscap

Access PHP Browscap outside web directory FastCGI


I am looking at enabling FastCGI to handle PHP execution on all of my domains. I tried it the other day and ran into one problem with my PHP configuration.

I currently have a php-browscap.ini located on my server that is used by all of my domains. It is located within my companies domain directory so something like this:

browscap = /var/www/vhosts/mycompany.com/httpdocs/scripts/php_browscap.ini

In order for this to work I wouldn't usually have to do anything because the apache user would have access to all of the web directories.

However, now that the user must be domain specific, I am having permission issues access the browscap. Does any body know a fix that I can implement into my PHP configuration to allow access to another domains directory?

I do not want to have to place a browscap file in each domains directory although I know this would be one fix

Would it work if I placed the file outside of the web directory?

e.g. /company/php-browscap.ini

Where 'company' is a custom folder in my root directory which contains scripts for my server. I havent tried this because it requires quite a lot of changes but if I know it will work then I will give it a go.


Solution

  • If you place the browsecap.ini file in a directory that has world read permission (e.g. 755 drwxr-xr-x) then FastCGI (or any user) can read the file. Such directories could be /usr/lib/php (if exists) or /usr/share.

    If you chmod the file to 744, then all users can read it but not delete or modify it, as long as all the parent directories are world readable as well.