Msaustral Posted January 10, 2019 Share Posted January 10, 2019 (edited) Hello everyone, I want to share my case with you, I know there are many people who are pulling their hair trying to solve this problem. When I install the prestashop on my private server, I start having Error 500 and it does not show some images in the frontend or in the back office. when I change the permission to the folders to 777 by FTP FileZilla everything works fine. I reinstall the store 5 times getting the same error. let's start with the 500 Error, as many post say it can be for many problems, in my case permission to write on folders, how to know what is wrong, well you need to find the Apache log in my case was in apache2->logs->error.log. You will be able download the file if your FTP user have permission to see the Apache installation folder, if you don´t contact you service provider. once you have the error.log, open it with wordpad and go to the last line, you will see something like this: [Thu Jan 10 14:29:58.021200 2019] [proxy_fcgi:error] [pid 30320:tid 140432560768768] [client xxxxxx:50400] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "xxxxxx/apache2/htdocs/xxxx/var/logs/prod.log" could not be opened: failed to open stream: Permission denied in xxxxxx/apache2/htdocs/xxxxxx/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 xxxxxx/apache2/htdocs/xxxxxx/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(39): Monolog\\Handler\\StreamHandler->write(Array)\n#1 xxxxxx/apache2/htdocs/xxxxxx/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php(59): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 xxxxxx/apache2/htdocs/xxxxxx/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(99): Monolog\\Handler\\AbstractHandler->handleBatch(Array)\n#3 xxxxxx/apache2/htdocs/xxxxxx/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(120): Monolog\\Handler\\FingersCrossedHandler->activate()\n#4 xxxxxx/apache2/htdocs/xxxxxx/...\n', referer: http://xxxxxx/adminxxxxxx/index.php?controller=AdminLogin&token=xxxxxx&redirect=AdminThemes to see if it is a permission problem with the folder just to try change it to 777 (remember all folders most have 755 and file 644), refresh the page where you are getting the 500 and you should be able to see it, if you don't please repeat the last step and check the new error. in my case I granted write public permission to logs/prod.log both folder and file and then the store (PrestaShop) wrote on the log prod.log the error which was: [2019-01-10 12:24:20] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Failed to create "xxxxxxxx/apache2/htdocs/xxxxxxxx/config/themes/xxxxxxxx": mkdir(): Permission denied." at xxxxxxxx/apache2/htdocs/xxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php line 104 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Failed to create \"xxxxxxxx/apache2/htdocs/xxxxxxxx/config/themes/xxxxxxxx\": mkdir(): Permission denied. at /xxxxxxxx/apache2/htdocs/xxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:104)"} [] the store can not create a directory on the custom theme, so I allow 777 permission to the custom theme folder and vuala!!! it works! After 2 days of searching, here is the solution. until now we know that is a permission issue on the prestashop folder. a folder have permission (write and read) for groups, owner and public (777 for write on all) and also has an owner and group owner. if the owner of the folder it is not the same as the user running the apache service on the server you will get 500 error, access denied, not authorize, etc... when we granted 777 to the folder it works because for the system the user running the apache service is consider a public access as it does not own the folder. how to solve it: first we need to know who it the user running the apache service by SSH console in the server, log in as a root an run apachectl -S this will give you all virtual host that you server is listen to and at the end you will find this: User: name="xxxxxx" id=xx Group: name="xxxxxx" id=xx once we have the user we assign the ownership to the PrestaShop folder by using this: chown -R user:group psfolder to check if the changes are made run ls -ld psfolder and you will see something like this: drwxr-xr-x 2 user group 4096 Dec 26 21:20 psfolder the word user and group change it for the user and group name running the apache and the psfolder for the presta shop folder done, if you run your store, everything should work, if it does follow these next step, if it doesn't go back to the troubleshooting and keep checking the logs for the next error change the permission of the PrestaShop folders, subfolders and files by: find folder -type d -exec chmod 755 {} \; find folder -type f -exec chmod 644 {} \; this should be all for the 500 and access denied then if you server is using Page Speed you will see this error on the error.log of the apache and some image won't load on the front end and back office [Thu Jan 10 14:30:13.696250 2019] [authz_core:error] [pid 30320:tid 140432344282880] [client xxxxx:50405] AH01630: client denied by server configuration: uri /img/70x119xpreston-login,402x.png.pagespeed.ic.7FV9FO9pvj.webp, referer: http://xxxxx/adminxxxxx/index.php?controller=AdminLogin&token=xxxxx as you can see is trying to load .webp image that does not exist on the folder but it is generating as the page is load. the problem is in the .htaccess on the psfolder->img that does not contemplate this Google image file, to solve the problem edit the .htaccess and change the line <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico)$"> for <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico|webp)$"> Now is all set, I hope this helps many people that have this issue. ENJOY!! Update!! Page Speed and prestashop is having some problem, some time image shows some time does not, so I disable Page Speed and configure Varnish with this file: https://github.com/nexylan/varnish-prestashop All good now, actually it works faster!! Edited January 10, 2019 by Msaustral (see edit history) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now