Error 500 in Magento - magento

I have successfully installed Magento in mylocalhost server and when i tried to open the admin and index i got this error
[Wed Aug 01 00:47:57.088443 2018] [php7:error] [pid 12976] [client ::1:48615] PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/magento2/var/page_cache" is not writable in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php:209\nStack trace:\n#0 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')\n#1 /var/www/html/magento2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')\n#2 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)\n#3 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)\n#4 /var/www/html/magento2/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)\n#5 /var/www/html/magento2/lib/internal/Magento/Framework/Cache/Frontend/Ada in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209, referer: http://localhost/
Have tried to do chmod 777 /var/www/html/magento2/var/page_cache still returning error

Simply write permissions needed on your cache directory
chmod 777 /var/www/html/magento2/var/page_cache
Or even just the full var directory:
chmod 777 /var/www/html/magento2/var - R
For security, those permissions aren't recommended on a production setting but should be fine for local development.
You basically need to make that directory writable by the web server, but that depends on your system setup and is a more complex answer. Probably overkill for this context

just change the permissions of directory "/var/www/html/magento2/var/page_cache" to 777
using following command.
sudo chmod 777 /var/www/html/magento2/var/page_cache
If there is no such directory, probably you need to create directory at given location and change the permissions.

Related

How to resolve permission denied # rb_sysopen

I am writing a simple recipe to create file like:
file '/myfile' do
content 'Welcome to Technical Guftgu'
action :create
end
but on chef-client -zr "recipe[test::recipe1]"
i am getting the following error:
[2022-03-08T10:54:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2022-03-08T10:54:16+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 02 seconds
[2022-03-08T10:54:16+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2022-03-08T10:54:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2022-03-08T10:54:16+00:00] FATAL: Errno::EACCES: file[/myfile] (test::recipe1 line 7) had an error: Errno::EACCES: Permission denied # rb_sysopen - /myfile
It seems that your app does not have access to the file /myfile.
Try this, to allow access to all: sudo chmod a+rw /myfile
Errno::EACCES Means "Permission Denied"
The Errno class is mapped to your system call errors at runtime. You can find this (confusingly) documented in:
SystemCallError#errno
Errno
In particular:
Errno.constants.include? :EACCES
#=> true
on most *nix sytems Errno::EACCES maps to the libc error code for "permission denied". Specifically:
Macro: int EACCES
"Permission denied." The file permissions do not allow the attempted operation.
That generally means your #create action doesn't have permissions to read, write, or traverse the path to the file you are trying to manage, so you need to change your implementation (which you don't show in your original post) to ensure that your Ruby process has the needed file or filesystem permissions to perform the requested operations.
See Also
Understanding Ruby's strange "Errno" exceptions
errno Lookup
errno.h from The Open Group Base Specifications Issue 7, 2018 edition

error with prestashop smarty template when adding price rule

I am getting following error when I add to catalog price rule and go to product page. when i checked the path /var/www/Germany/cache/smarty/compile/43/ and check directory there is no directory found
[Tue Jul 31 08:19:55.349417 2018] [:error] [pid 9379] [client
172.31.22.27:19804] PHP Fatal error: Uncaught --> Smarty: unable to write file
/var/www/Germany/cache/smarty/compile/43/b7/ef/wrt5b601bab5205b6_55461255
<-- \n thrown in
/var/www/Germany/tools/smarty/sysplugins/smarty_internal_write_file.php
on line 46, referer:
http://de.galaxykayaks.eu/admin088rkbwnk/index.php?controller=AdminProducts&id_product=34&updateproduct&token=9149fd1199969891eb153b8825d58dbb
please help me what is the issue
First, try to disable the cache.
Second, check your permissions files/folders, because it looks like this kind of problems
This issue with the wrong old version override folder smarty cache file
When I remove the old smarty cache file then its work fine.

Solve 500 response Laravel (Uncaught UnexpectedValueException: Laravel.log)

I have a problem with my (new/clean) Laravel (tried v5.2 and v5.5) application on Centos 7. It shows a 500 error when i visited the URL of the application with no error. I checked the log file of apache (/etc/httpd/logs/error-log.log) what contained the 2 errors bellow:
[Mon Dec 04 10:32:34.108956 2017] [:error] [pid 25889] [client 192.168.1.240:63437] PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/public/blog_project/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n#3 /var/www/public/blog_project/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)\n#4 /var/www/public/blog_project/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(U in /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
&
[Mon Dec 04 10:32:34.109334 2017] [:error] [pid 25889] [client 192.168.1.240:63437] PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/public/blog_project/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3 /var/www/public/blog_project/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4 /var/www/public/blog_project/vendor/laravel/framework/src/Illuminate/Log/Writer.p in /var/www/public/blog_project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
To solve these problems i Googled a lot. Solutions i found where all related to permissions so I tried to set chmod 777 to all directories and files (for test purposes, not recommended at live environment!) in /var/www/public/blog_project but this did not solve the problem.
I also found that the owner/group could be the problem (unlikely with chmod 777 but ok) so I changed the owner and group to "apache". Unfortunately this did still not solve my problem.
I also tried a "php artisan cache:clear" (suggested in some topic what described the same problem as i have)
At the moment of writing i already had found the solution (after many hours of Googling) for my problem but i still want to post this question because i could not find another question what solved my problem. I hope to help other people who have the same problem this way.
The problem was that SELinux was enabled which prevent Apache to write files even with 777 mode. It seems that SELinux is active by Centos 4 or higher by default. I also found that Fedora has SELinux activated what results in the same problem (no own experience with Fedora).
I solved the problem by disabling SELinux. For CentosOS7 id did this by editing /etc/sysconfig/selinux
and changing the line SELINUX=enforcing into SELINUX=disabled. After that i rebooted the server and the problem was solved.
I solved the problem by disabling SELinux. For CentosOS7 id did this by editing /etc/sysconfig/selinux and changing the line SELINUX=enforcing into SELINUX=disabled. After that i rebooted the server and the problem was solved.
Thanks :)
please don't disable your selinux. there is a better way to do it
See this, i posted a better way Laravel: file_put_contents() failed to open stream: Permission denied for Session folder

Magento before install on centos 7 getting 500 internal server error

Hi I am trying to install magento 1.9.x and magento2 in my centos operating system.. the following links help to configure apache2.4, php7 and mysql5.7 in centos.
Install magento link
after configure web server, php, mysql, magento files and all. I create database for magento2. Based on above link i did all steps one-by-one. After i run in browser localhost/magento2/
it show 500 Internal server error in firebug and blank browser.
I am beginner of centos and magento
Please any one help how to solve this problem i was spend past two days.
Apache error log:
[Sat Sep 10 14:22:33.728848 2016] [:error] [pid 2809] [client
::1:45432] PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir
"/var/www/html/magento2/var/page_cache" is not writable in
/var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php:209\‌​nStack
trace:\n#0
/var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache/Backend/‌​File.php(180):
Zend_Cache::throwException('cache_dir "/var...')\n#1
/var/www/html/magento2/vendor/colinmollenhour/cache-backend-‌​file/File.php(87):
Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')\n‌​#2
/var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php(153)‌​:
Cm_Cache_Backend_File->__construct(Array)\n#3
/var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php(94):
Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)\n#4
/var/www/html/magento2/lib/internal/Magento/Framework/App/Ca‌​che/Frontend/Factory‌​.php(158):
Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...',
Array, Array, true, true, true)\n#5
/var/www/html/magento2/lib/internal/Magento/Framework/App/Ca‌​che/Frontend
in
/var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php
on line 209
To me this look like the main problem:
Uncaught Zend_Cache_Exception: cache_dir
"/var/www/html/magento2/var/page_cache" is not writable in /var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php:209\‌​nStack
You have the wrong permissions or wrong owner for this folder. You can fix this using chown for fixing the owner of that folder or chmod for fixing writing permissions for that folder.
Try this:
chown -R apache.apache /var/www/html/magento2/
This sets the whole magento2 folder to have apache as owner and group. It is not the best security measure but for testing is fine.

Laravel5 cashier downloadInvoice() permission denied error

Unable to download pdf generated with laravel 5 cashier and phantomjs. Throws following error:
ProcessFailedException in Process.php line 233: The command "/PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs invoice.js /PROJECT/storage/framework/48dc273eaff3a0adaab8aa4f5b1d73df.pdf" failed.
Exit Code: 126(Invoked command cannot execute)
Output:
================
Error Output:
================
sh: 1: /PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs: Permission denied
I checked storage/framework/ directory pdf has been created with permission 644 and www-data. My storage directory has 777 permission and user say xproject
Can anyone help me to get rid of this error?
I had exactly the same error and after much searching I found this post https://alfrednutile.info/posts/149 by Alfred Nutile
You solve the issue by adding execute permissions to the bin folder recursively:
chmod -R +x vendor/laravel/cashier/src/Laravel/Cashier/bin

Resources