Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003

    open_basedir restriction in effect

    I'm tryin' to share files (mySQL) between 2 domains on my linux server and 'open_basedir restriction in effect' is stopping it from happening:

    Warning: fopen(): open_basedir restriction in effect. File(/home/user2/public_html/ct/thumbs/tn1.jpg) is not within the allowed path(s): (/home/user1:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/user1/public_html/ct/admin/export.php on line 480 
    Warning: fopen(/home/user2/public_html/ct/thumbs/tn1.jpg): failed to open stream: Operation not permitted in /home/user1/public_html/ct/admin/export.php on line 480

    I really don't know what it could be... from what I get in /usr/local/lib/php.ini, safe mode is off:

    ; Safe Mode
    safe_mode               =       Off
    safe_mode_exec_dir      =
    safe_mode_allowed_env_vars = PHP_                                       
    safe_mode_protected_env_vars = LD_LIBRARY_PATH

    Hope you can help! Thanks!

  2. #2
    Join Date
    Jul 2003
    What this error means is that PHP is restricted to open only those files that are in your public_html directory and below.

    For security reasons, this makes sense. No point in giving a user access to the file system above his or her web root.

    You can override this setting from .htaccess (assuming you have the rights to overwrite it).
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  3. #3
    Join Date
    Feb 2004

    This error is because the safe mode is turned on.
    So Please try this.....

    Just use move_uploaded_file() instead of copy()

    working example;
    File upload
    File upload
    <form enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>"
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000">
    Send this file:
    <input name="userfile" type="file">
    <input type="submit" name="submit" value="Send File">

    // copy to this directory

    // copy the file to the server
    if (isset($submit)){

    if (!is_uploaded_file ($userfile)){

    echo "$userfile_name couldn't be copied !!";

    // check whether it has been uploaded
    if (is_uploaded_file ($userfile)){
    move_uploaded_file($userfile,$dir.$userfile_name) ;}

    echo "$userfile_name copied succesfully !!";


    If you get still errors then let me know



  4. #4
    Join Date
    Nov 2003
    Thanks guys... Turns out WHM had a feature in Tweak Security allowing me to disable the open_basedir restrictions for the desired domain... and it worked out well...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts