You don't have permission to access foo.php on this server.

Discussion in 'Apache' started by guarriman, Mar 27, 2008.

  1. #1
    Hi.

    Using Apache/2.2 + PHP/5.2, I'm suffering an odd issue when accessing
    an image generated with PHP.

    When I access:
    http://www.foo.com/script.php

    I get *SOMETIMES* this error message

    
    Forbidden
    You don't have permission to access /script.php on this server.
    
    Code (markup):
    This is my Apache configuration (I use Plesk)
    
    DocumentRoot "/var/www/vhosts/foo.com/httpdocs/web"
    <Directory "/var/www/vhosts/foo.com/httpdocs/web">
    php_admin_value open_basedir "/var/www/vhosts/foo.com/httpdocs:/tmp:/usr/share/pear/plugins:/usr/share/php/plugins"
    Order Allow,Deny
    Allow from all
    AllowOverride all
    DirectoryIndex index.php
    </Directory>
    
    Code (markup):
    Most of times I access ok to the image, without any error message. Any similar experience?

    All my files have the same owner and the same permissions. Thank you very much.
     
    guarriman, Mar 27, 2008 IP
  2. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Since it is not regular, I'd think it is a server protection issue, to block your site from loading too much at a time or something. This happens a lot on site that attract a lot visitors on shared hosting.
     
    Randombase, Mar 27, 2008 IP
  3. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have seen this error message when the server reaches its maximum number of open file handles. That would also explain the randomness of the error message. It all depends on how many other files you have open at the same time.

    You might be able to tell if this is the problem by running "lsof" on your server.

    You may also just need to tell your hosting company about the problem and get them to fix it.
     
    Ladadadada, Mar 27, 2008 IP
  4. guarriman

    guarriman Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You are probably right. I was suffering a lot of these error messages on my Apache 'error_log' file
    
    [Wed Mar 26 13:05:39 2008] [warn-phpd] mmap cache can't open
    /var/www/vhosts/foo.com/httpdocs/classes/Threads.php - Too many open files (pid 17650)
    [Wed Mar 26 13:05:42 2008] [warn-phpd] mmap cache can't open
    /var/www/vhosts/foo.com/httpdocs/classes/User.php - Too many open files (pid 17650)
    [Wed Mar 26 13:05:46 2008] [warn-phpd] mmap cache can't open
    /var/www/vhosts/foo.com/httpdocs/lib/Functions.php - Too many open files (pid 17650)
    
    Code (markup):
    Which I'm trying to fix by rising the file limit:
    
    []# ulimit -n 16384
    
    Code (markup):
    Thank you very much for your answer.
     
    guarriman, Mar 28, 2008 IP