Tips and Tricks

PHP open_basedir

PHP open_basedir directive is used to limit the files that can be opened by PHP to a specific directory-tree. What does that mean? With the open_basedir directive, you can tell the PHP scripts on a domain, which folders they have access to. Once specified, the PHP scripts will not be able to access files outside those folders.

On most cPanel servers, as part of a basic security audit, PHP open_basedir is enabled for all domains. Limiting access to files in that domain alone. This is a fine security measure, but what if your customer has multiple domains on the same server, and needs PHP scripts on one domain to access the files on another domain? This is where our little tutorial can help. By disabling PHP open_basedir only for these domains, you don’t have to sacrifice on the security of the other domains.