WHMCS - open_basedir restriction in effect

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
I can't seem to get crons to work, no errors or anything. I read to try run the cron directly in SSH and can't this. Would anyone be able to shed some light?

Code:
Warning: realpath(): open_basedir restriction in effect. File(/home/*/public_html) is not within the allowed path(s): (0) in /home/*/public_html/cogmin/../init.php on line 0

Warning: file_exists(): open_basedir restriction in effect. File(/includes/classes/WHMCS/Init.php) is not within the allowed path(s): (0) in /home/*/public_html/cogmin/../init.php on line 0
<div style="border: 1px dashed #cc0000;font-family:Tahoma;background-color:#FBEEEB;width:100%;padding:10px;color:#cc0000;"><strong>Down for Maintenance</strong><br>One or more required files are missing. If an install or upgrade is not currently in progress, please contact the system administrator.</div>
 
Last edited by a moderator:

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
Thanks for fixing my post Infopro. Unfortunately, the owner of the post said he "found the docs" but no indication where or what docs.

I'm a newbie server admin. I now tried changing the php handler from DSO + mod_ruid2 to SuPHP (had to recompile to remove the mod_ruid2) as the post you referred to also said. As soon as it went live, all my sites broke with "No input file specified." scared me so switched back, and now a few of my clients are having upload file issues - basically same error as above with "open_basedir restriction in effect". I think it would also be worthwhile mentioning I'm also using config server scripts if that may influence it in any way?

I found https://documentation.cpanel.net/display/1144Docs/PHP+open_basedir+Tweak but I'm not sure how to use this information.

Really sorry if it's such a newbie question.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello,

Are you using a custom configuration where you are sharing files between multiple accounts? Note the option you are referring to is manageable via:

"WHM Home » Security Center » PHP open_basedir Tweak"

Thank you.
 

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
Thanks for the reply Michael. No, not sharing files between accounts at all. open_basedir is enabled. And after disabling it I get this on all my accounts:

Code:
Warning: Unknown: open_basedir restriction in effect. File(/home/onyxsacc/public_html/index.php) is not within the allowed path(s): (0) in Unknown on line 0

Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/onyxsacc/public_html/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Are you using a custom php.ini file with that account? Is suPHP still the PHP handler?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Is this only reproducible with WHMCS? I see you have opened a thread on the WHMCS forums, so you should receive a response to it shortly.

Thank you.
 

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
No, it occurs on website with file upload as well. I posted it to WHMCS as well in hoped to get direction sooner.

Code:
[05-May-2015 16:48:10 UTC] PHP Warning:  Unknown: open_basedir restriction in effect. File(/home/printfyc/public_html/index.php) is not within the allowed path(s): (0) in Unknown on line 0
[05-May-2015 16:48:10 UTC] PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[05-May-2015 16:48:10 UTC] PHP Fatal error:  Unknown: Failed opening required '/home/printfyc/public_html/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
[05-May-2015 16:48:11 UTC] PHP Warning:  Unknown: open_basedir restriction in effect. File(/home/printfyc/public_html/index.php) is not within the allowed path(s): (0) in Unknown on line 0
[05-May-2015 16:48:11 UTC] PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[05-May-2015 16:48:11 UTC] PHP Fatal error:  Unknown: Failed opening required '/home/printfyc/public_html/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
 

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
If I disable open_basedir, I get this on all of my sites.

Code:
Warning: Unknown: open_basedir restriction in effect. File(/home/onyxsacc/public_html/index.php) is not within the allowed path(s): (0) in Unknown on line 0

Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/onyxsacc/public_html/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 
  • Like
Reactions: dorac

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
Already been on it, thanks Michael. I've spoken here, WHMCS, with my host that's also tried helping but they've been having serious network issues these last two days so their hands have been tied.

6462887
 

dorac

Member
Jun 7, 2013
22
4
3
South Africa
cPanel Access Level
Root Administrator
Answer from ticket:

It appears that open_basedir had been activated on your server manually as well. In your php.ini file I found this:

=========================================================
[20:45:53 cogit [email protected] ~]cPs# grep -i basedir /usr/local/lib/php.ini
; open_basedir, if set, limits all file operations to the defined directory
open_basedir = 0
=========================================================

However normally on a cPanel server, regardless of if open_basedir is enabled or not in cPanel, the same query looks like this:

=========================================================
-bash-4.1# grep -i basedir /usr/local/lib/php.ini
; open_basedir, if set, limits all file operations to the defined directory
;open_basedir =
=========================================================

As such, I backed up this file on your server, commented out that line, and restarted Apache. I used these commands to do this:

=========================================================
[20:47:01 cogit [email protected] ~]cPs# cp -p /usr/local/lib/php.ini{,_bak}
=========================================================
[20:47:23 cogit [email protected] ~]cPs# vi /usr/local/lib/php.ini
=========================================================
[20:47:51 cogit [email protected] ~]cPs# /scripts/restartsrv_httpd
=========================================================
[20:48:02 cogit [email protected] ~]cPs# grep -i basedir /usr/local/lib/php.ini
; open_basedir, if set, limits all file operations to the defined directory
;open_basedir = 0
=========================================================
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
I am happy to see the issue is now resolved. Thank you for updating us with the outcome.