The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-General - PHP Script - access denied
Discuss PHP Script - access denied in the PHP Development forum on Dev Shed. PHP Script - access denied PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 16th, 2012, 12:11 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 3
Time spent in forums: 26 m 14 sec
Reputation Power: 0
|
|
|
PHP-General - 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
|

November 16th, 2012, 07:06 AM
|
|
|
|
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.
|

November 16th, 2012, 07:38 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 3
Time spent in forums: 26 m 14 sec
Reputation 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?
|

November 16th, 2012, 07:50 AM
|
|
|
|
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?
|

November 16th, 2012, 08:44 AM
|
 |
Lost in code
|
|
|
|
|
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?
|

November 17th, 2012, 03:36 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 3
Time spent in forums: 26 m 14 sec
Reputation 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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|