Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default Include Problem

    I have some strange problems including files from other accounts on cPanel server. This server is NOT managed by me, so I need some suggestions what could be wrong. Here is my code:


    include_once(/home/aaa/public_html/file.php);


    And I get this error - Warning: include_once(/home/aaa/public_html/file.php) [function.include-once]: failed to open stream: Permission denied

    Warning: include_once() [function.include]: Failed opening '/home/aaa/public_html/file.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php'


    I checked /home/aaa/public_html/file.php and permissions/ownership is OK. open_basedir protection is disabled. What else could be wrong?

    Trying to delete and re-create account "aaa" (so it got new files) didn't solve problem

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Is the server running SuPHP?

    Note, if you do not have root access to the server, you really should be contacting your hosting provider regarding these issues.

  3. #3
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default

    I just got root access. Server was running SuPHP, and I disabled it now, but problem still exists

  4. #4
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    Who owns the PHP script that is doing the include?

    Who owns the file /home/aaa/public_html/file.php?

    What are the permissions on the /home/aaa/public_html/file.php file?

  5. #5
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default

    /home/aaa/public_html/file.php is owned by aaa

    /home/aaa/public_html/file.php has permissions 644

  6. #6
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    The file that contains the code:

    PHP Code:
    include_once("/home/aaa/public_html/file.php"); 
    Who owns that file?

  7. #7
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default

    This file is owned by user where file is located, of course.

    I just checked all permissions once again and everything is perfect. I even created new accounts, uploaded new files, and issue still exists - files could not be included from other users. Like I said, open_basedir is disabled at all.

  8. #8
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    So another words the PHP script is not owned by the user aaa?

  9. #9
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default

    PHP scripts are owned by users where scripts are located.

    For example, /home/aaa/public_html/file.php is owned by "aaa".


    Let's say I include this file from /home/abc/public_html/test_include.php. In this case /home/abc/public_html/test_include.php is owned by user "abc".


    Same scripts work fine on 13+ servers

  10. #10
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    This has to do with the permissions of the parent folder of the file you are trying to include.

    /home/aaa/public_html/file.php may have 0644 permissions, but I bet /home/aaa/public_html has permissions of 0750. Try changing the permissions on /home/aaa/public_html to 0755 and it should work.

    For whatever reason it seems that include() needs to be able to traverse into the parent directory to include the file. I am not sure if this is the intended behavior or if this is a bug in the way PHP handles includes.

  11. #11
    Member
    Join Date
    Feb 2005
    Posts
    74

    Default

    Permissions are OK. Like I said, I even created new accounts, used new includes (from new accounts), and nothing works on this server. It drives me crazy now

Similar Threads & Tags
Similar threads

  1. Pre Main Include or Post VirtualHost Include ?
    By SecondSight in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 11-15-2010, 12:07 AM
  2. PHP 5.25 Include Problem
    By BrandMan211 in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 12-19-2007, 03:25 PM
  3. php include problem
    By cosmin in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 05-10-2007, 10:18 PM
  4. include.inc error
    By jasons in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-21-2004, 04:07 PM
  5. Include Pages?
    By jackal in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-04-2003, 10:17 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube