#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    PHP Script - access denied


    Hi,

    I have been developing a website which runs ok on my laptop. I have now put it online but have hit a problem.

    When my site loads a javascript function calls a php file to create a list of values from the database. That works fine. When the same file is subsequently called from the same javascript function to refresh the list of values I get a 'Forbidden You don't have permission to access... updateTimes.php.'

    First, I changed all file permissions to 755. Same problem. Then I moved all php files out of the public_html directory and created a new php file 'submitProcess.php' to which the name of the particular file to be run is passed as a parameter. I get the same error message in the same situations as before - telling me now that I do not have access to submitProcess.php, but this depends on which particular script is being called from submitProcess, and on whether it is called on load or by a subsequent call to the same file.

    I am confused and do not know what else to try or where to look.

    Kevin
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,493
    Rep Power
    594
    Your description is a bit confusing. You mention javascript which is client side and then PHP which it server side. Are you using Ajax or is your javascript loading a PHP page? Either way it has nothing to do with javascript per se. It is difficult to debug permissions problems without looking at the actual OS directory tree. The error you describe indicates a problem with updateTimes.php so messing with all the other files is just confusing the issue. Look at that file and see how it is different with respect to ownership, permissions and possibly path from all the rest.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0
    To clarify:

    Yes, Ajax, to be specific. As javascript is client side it can only access files in public_html. There is only one php file in public_html, namely submitProcess.php (other than index.php). Therefore I know all php files must be called via submitProcess.php, as only php and not javascript can access the other php files.

    However, when I get an error message it refers to submitProcess.php, telling me I don't have permission to access it. But some processes run, and updateTimes runs successfully on load (as stated, necessarily via a call to submitProcess).

    May I assume then that the error message does not necessarily mean what it says and that the problem may be within the php file being called and that it may not be a problem with permissions?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,493
    Rep Power
    594
    What user is running submitProcess.php, when called via Ajax? Assuming it is apache, does that user or its group have rx permissions on updateTimes.php?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    Copy and paste the exact and full error message that you're getting.

    Is the error message being thrown by JavaScript? Or is it being returned in the HTTP response for the page? What is the status code returned in the HTTP request?
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0
    This is solved, although in the end it had nothing to do with file permissions. There was an undefined parameter being passed to the procedure and correcting that seems to have solved the matter.

    Kevin

IMN logo majestic logo threadwatch logo seochat tools logo