Recently I saw that some of the images were not displayed on a particular webpage, I checked if the image was available under the images folder, yes it was with the correct name!
I checked the Chrome Browser's console logs and It said: GET http://localhost/myapp/images/4.jpg 403 (Forbidden). I tried accessing the image via URL and I could see this access type error!Access forbidden!
You don't have permission to access the requested object.
It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3
Reason for 403: Well it was obvious that it has something to do with the access permissions of the file, as I work on a Unix based operating system.
Solution to resolve 403 forbidden error:Check the access permissions for the file: Read permission should be allowed for the Others, its best to make permission settings to 644 using CHMOD
644 = (rw- r-- r--): group/others can to read the file. The owner can write to it, others cannot write or execute it. I hope it helps someone!More Posts related to PHP,
- PHP Code for sending Emails
- PHP drag and drop file upload tutorial using dropzone.js
- Delete file using PHP code : unlink()
- Save current timestamp in MySQL using PHP mysqi binding
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP Warning: Cannot modify header information - headers already sent
- PHP header location function not called
- How to destroy PHP session()
- Upload docx file using PHP script
- Call PHP function on Button click using jquery ajax
- Upload Pdf file using PHP Script
- 403 forbidden error for Image
- PHP Base64 encoding decoding a variable
- PHP 301 Redirect Permanently
- Copy file from one directory to other in Php
- PHP Script to Upload Images to Server
- Installing vue.js in Laravel 8
- PHP Fatal error : Call to a member function bind_param() on a non-object
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes
- macOS - cannot calculate MAC address: Using fd 9 hv_vm_create HV_ERROR [PHP XAMPP]
More Posts:
- PHP header location function not called - PHP
- How to stop disable Facebook video autoplay during scroll - Facebook
- How to Set Permanent ruler in Sublime Text - Sublime-Text
- How to install zsh shell on Ubuntu - Ubuntu
- Emulator: Warning: restoring GLES1 context from snapshot. App may need reloading. - Android-Studio
- How to Merge Branch into Master Branch - Git
- Android Studio NoClassDefFoundError: java.awt.Toolkit - Android-Studio
- Enable spell check in Sublime Text (macOS) - MacOS