How to Enabled PHP open_basedir in CWP

How to Enabled PHP open_basedir in CWP

Tutorial how to enabled PHP open_basedir in CWP Control panel.

Enabled PHP open_basedir in CWP Linux Server.

We have two options:

1) global config, one config file in the include folder /usr/local/php/php.d/ and in php selector include folders

2) per user config, the securest option as it restricts user to his /home/USERNAME folder and also disables users from using a custom php.ini files.

Global Configuration:

The securest method do this correctly and to prevent users from overriding this is to place the config into the include file. Please note that if you set this into /usr/local/php/php.ini then custom user php.ini will be able to disable it. Please note that global config allows full /home folder access while per user restricts users to /home/USERNAME folder which is much more secure.

One line command to create a file and config:

echo "open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/" >/usr/local/php/php.d/open_basedir.ini  

You can also do it by yourself by creating a file with the following content:

open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/  

Per User open_basedir:

To enable per user open_basedir you can create php.ini file in the users /home folder.

Recommended Article: How to Setup OpenVPN On Windows Server 2019


Please note that this option will also disable all further custom users php.ini files per folder, example: /home/USERNAME/public_html/php.ini will not be loaded.

You can also place it into public_html folder.

but then users will be able to run custom php.ini files per folder and they can disable open_basedir.

We hope you enjoy using php in cwp.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day