I have created a new Page in Wordpress. On this page, I have put the following HTML code:
Please click this link to view the details.
statistics.php has the code to query the backend MySQL database, fetch the details and display in a table format.
however, when I click the link on the Wordpress Page I get a 403 forbidden message.
Forbidden
You don't have permission to access /blog/wp-content/themes/twentytwelve/statistics.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I have tried setting the permissions of the PHP file to both, 644 and 755. Error still persists.
I have even tried putting a simple code like this in the PHP file:
<?php echo "welcome"?>
Even then, the same 403 forbidden error.
Now, I have another page on this Wordpress Site. In that page I have an HTML Form that sends a POST request to a PHP file called process.php which is present in the same directory as statistics.php. That page works properly.
So, I tried replacing the URL in my new page from statistics.php to the process.php. That does not give a 403 forbidden error.
Why is it that I am unable to access one PHP file from my wordpress page? Am I allowed to link only to one external PHP file from wordpress page?
both statistics.php and process.php have the same permissions. However, while one page is able to easily access process.php, the other page gives an error for statistics.php.
Help would be much appreciated.
Thanks.
The directory you have your script under is not readable and neither should it be. It is used by wordpress to store the themes, and this directory can only be read by wordpress in order to output the theme to the front end.
Try placing your scripts in a directory which is not controlled/needed by WordPress. i.e., on your public root, create a new readable directory and place under that directory whichever scripts you need.
Related
I have been trying to load an section of page using iframe in my wordpress site. I can load certain sites in the iframe without any issue but while i try my required page it doesn't work as expected just inside the page. The iframe src is loading perfectly if its opened individually
I have tried most of the answers mentioned here in stackoverflow and other forums, still can't get a solution for this. I tried adding code in .htaccess, also tried adding code in functions.php
This is the iframe src I want to load.
It can be loaded individually in browser but not inside an iframe. I am getting the following error in console while i try to load it :
[ERROR] Permission denied to access property "hash" on cross-origin object
Is this an issue with my code, server config or with the URL itself?
Thanks
It's about your source is blocking unauthorization call from domains not in CORS. They're only allow call from Origin https://ec.europa.eu. The short answer, you can't deal anything from your side.
More information about CORS: https://developer.mozilla.org/en/docs/Web/HTTP/Access_control_CORS
Getting this weird error on the server after trying to upload images with size greater than 20k. Images below that size will be uploaded successfully.
What is the problem?
by the way, the configuration in the php.ini is
upload_max_filesize = 96M
post_max_size = 96M
I am using PHP 5.6
Can you help me please ?
There can be several causes for your problem. Please check all points listed here:
The 403 Forbidden error is an HTTP status code which means that
accessing the page or resource you were trying to reach is absolutely
forbidden for some reason.
There are three common causes for this error. Here they are listed from most likely to least likely.
Empty httpdocs directory
Make sure that your website content has been uploaded to the correct directory on your server. Remember to replace example.com with your own domain name.
DV server: /var/www/vhosts/dv-example.com/httpdocs/
When you connect with your FTP user, you just need to navigate into the httpdocs directory.
If this folder does not exist, feel free to create it.
No index page
The home page for your website must be called index.php or index.html.
To resolve this error, upload an index page to your httpdocs directory.
If you already have a home page called something else - home.html for example - you have a couple of options:
Rename your home page to index.html or index.php.
Set up a redirect on the index page to your real home page. See How do I redirect my site using a .htaccess file? for details.
Set a different default home page in your .htaccess file. Javascript Kit has a good example.
If you don't want a single page to display, but instead want to show a list of files in that directory, see Making directories browsable, solving 403 errors.
Permissions and ownership errors
A 403 Forbidden error can also be caused by incorrect ownership or permissions on your web content files and folders.
source: https://mediatemple.net/community/products/dv/204644980/why-am-i-seeing-a-403-forbidden-error-message
I think your problem is the third point. You don't have permissions for an upload.
I'm using a shared hosting service for my sites and there is a strange situation.
When any php page is accessed from a link (like Google search results page, etc), the page will not open.
The following error is shown:
"Forbidden you don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."
If the same url is input directly into the browser, the page displays fine.
The situation is not the same for html extension pages, which open properly from links too.
I am not using any .htaccess file.
Permission for files is 644 (I've never changed anything).
This situation is something new, there was not such a problem in the past.
Any advice is welcome.
I created a subdomain in plesk and tried to upload an index.html with some text on it, It renders well.
However, when I tries to upload an index.php with a basic text on it, it shows
Forbidden
You do not have permission to access this document.
The same error that shows when my subdomain folder is empty. At the same time it downloads a file which contains my index.php code.
Anyone have some idea about this? thank you in advance
I want to close one of my directories public access on my PHP server but at the same time same directory should be still accessible, so what I want to do is when user types that directory from browser like stackoverflow.com/directory they will see it closed/empty but when they want to access a file under that directory like stackoverflow.com/directory/file.php they will be able read and submit form on it. Any ideas how can I do this?
Many thanks
Another method, using .htaccess file in the root
Options -Indexes
Now if a folder does not have an index.html/php file the server will respond with a 404 file not found error and send people your error page. Rather than a directory listing denied using the previous method.