Forum Moderators: coopster

Message Too Old, No Replies

Include not working after moving to new server

         

dougmcc1

8:02 pm on Aug 2, 2015 (gmt 0)

10+ Year Member



Hi,

I recently got a new server and moved my websites to it but now one of my includes isnt working.

It's an include that calls a file from another account in cpanel. I have a file that contains all the functions that a few of my websites use so that I only have to update one file on one account in case I need to update my functions.

Here is the include error:
Warning: include(/home/abc/public_html/admin/includes/functions.php): failed to open stream: Permission denied in /home/xyz/public_html/admin/definitions.php on line 2

Warning: include(): Failed opening '/home/abc/public_html/admin/includes/functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xyz/public_html/admin/definitions.php on line 2

Fatal error: Call to undefined function createTables() in /home/xyz/public_html/admin/definitions.php on line 44

Obviously the fatal error is due to the site not being able to include the functions.php file that contains the createTables() function. But I'm not sure why the file isnt able to be included. I even tried changing permissions to 777 in the abc folders and that still didnt work.

Any ideas please?

whitespace

10:14 pm on Aug 2, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



Presumably this is a server that you control?

You can't normally access files from other accounts on a shared server because of the open_basedir core php.ini directive. (You don't normally want users from other accounts accessing your files!)

So, if you have access, that would be the first place I'd check.

Reference:
PHP Manual - open_basedir [php.net]

dougmcc1

4:33 am on Aug 3, 2015 (gmt 0)

10+ Year Member



Thanks for the reply. It's my server so I do have access to everything on it including the php.ini file.

open_basedir is currently not set in the php.ini file so I dont think it is limiting anything unless I'm reading this wrong:
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =

Since its not set, it shouldnt be limiting me right?

Any other ideas?

robzilla

9:58 am on Aug 3, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you have the same version of cPanel on the old server, where you did not have this problem?

To work around it, maybe set up a cron job that replicates the required files across the domains that use them?

whitespace

11:20 am on Aug 3, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



I assume you are running PHP 5.4+, so safe_mode won't be an issue (default off anyway). AFAIK open_basedir is the only thing at the PHP-level that would block access, so this is more likely to be something at the Apache/Linux level I would think - may be more appropriate for the Apache forum?

Have you tried creating a symlink to this file and ensure that you have "Options +FollowSymLinks" set? (Note that this is something that open_basedir would have otherwise blocked.)