Magento before install on centos 7 getting 500 internal server error - magento

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.

Related

Error 500 in 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.

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

Code Igniter / Pyro CMS Call to a member function result_array() on boolean

I have just downloaded a git of a site running on Pyro CMS on the Code Igniter PHP framework and tried to run it locally however it is throwing this error:
[Mon Jul 24 10:05:39.868253 2017] [:error] [pid 5944:tid 1944] [client ::1:55468] PHP Fatal error: Call to a member function result_array() on boolean in C:\\xampp\\htdocs\\system\\codeigniter\\database\\DB_driver.php on line 831
I have tried using result() rather than result_array() however it throws the same error.
The site is running on PHP version 5.6.31 on an XAMPP local server.
Below is the file which is throwing the error:
https://pastebin.com/QXSUD5u6
Little late to the party here but usually that happens in codeigniter when there is no database connection. Check the database config file to make sure it is properly set up for your local host credentials; my guess is that it is still configured to access the 'online' database from which you downloaded the files.

mvn appengine:update will not deploy due to permissions error

I am trying to deploy a basic app engine web app with maven.
As a part of the deployment process, I am required to authenticate via a web browser.
I am using 2 different google accounts. 1 for home. 1 for work. When maven opened up the browser tab to ask me to authenticate, it selected the wrong account. I didn't notice this and clicked the "Allow" button.
This account does not have the right credentials so I got an access denied error.
😈 >mvn appengine:update
...
Beginning interaction for module default...
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #0
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #1
Apr 01, 2016 4:47:32 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #2
Apr 01, 2016 4:47:33 PM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=maven-1268&version=1&
403 Forbidden
You do not have permission to modify this app (app_id=u's~maven-1268').
This is try #3
So I think "no biggee", I'll just run it again. Somehow I'll get maven to select the correct account (maybe I'll temporarily logout of the incorrect one) and that will solve the problem.
Unfortunately, I am no longer being prompted to authenticate. It just keeps giving me accessed denied errors.
I am presuming there is a file somewhere on the file system that I need to delete in order to get prompted for my authorization again.
Does anyone know where this file is?
UPDATE
I tried completely recreating my project from scratch in a different directory, and I still get the access denied errors.
By running this command ...
mvn help:describe -Dplugin=appengine -Ddetail
I have discovered that there is an additional parameter that I can pass to the update goal that will do exactly what I need it to do, but I don't know how the correct syntax to use to actually pass this additional parameter.
appengine:update
Description: Create or update an app version.
Implementation: com.google.appengine.appcfg.Update Language: java
Before this mojo executes, it will call:
Phase: 'package'
Available parameters:
additionalParams
User property: appengine.additionalParams
Additional parameters to pass through to AppCfg.
noCookies
User property: appengine.noCookies
Do not save/load access credentials to/from disk.
I think this might be the correct syntax ...
😈 >mvn appengine:update -DadditionalParams="--noCookies"
However, this does NOT solve the problem as the update seems to ignore the parameter.
I fixed the error using this command before mvn appengine:update command:
rm ~/.appcfg_oauth2_tokens_java
I was able to solve this problem by using the appcfg.sh tool instead of maven.
😈 >appcfg.sh --no_cookies update /path/to/maven/project/first_project_second_try/guestbook/target/guestbook-1.0-SNAPSHOT
I suspect that it is possible to do this with maven as well, but I am uncertain as to how pass the "--no_cookies" option to maven.

(random?) 500 errors in Magento front and backend - version 1.4.1.1

i need your help once again :)
For some time now i get strange 500 errors in the front and backend of magento. I use magento 1.4.1.1.
The errors can appear everywhere, anytime. I get about 10-20 of them every day. The errorlog reads something like this:
[Wed Oct 17 16:02:19 2012] [warn] [client 93.219.97.29] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: /index.php/admin/sales_order/view/order_id/1617/
[Wed Oct 17 16:02:19 2012] [warn] [client 93.219.97.29] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: http://www.xxxx.com/index.php/admin/sales_order/view/order_id/1617/
I have attached a screenshot of the error.
http://i.imgur.com/i6dvO.jpg
Do you guys have any idea what i can do? Thank you very much :)
Greets
I was receiving similar errors on 1.7.0.2 community edition on a Ubuntu 10.04 LTS LAMP server. In my case (using Virtualmin) I had incorrectly set the virtual server to run php in FastCGI as the website owner. The apache user is different from the site owner, and magento multi-site install was setup to run as that apache user.
ALSO, I had uncommented Magento's profiler inside index.php Varien_Profiler::enable();
and turned on the profiler via Magento admin panel (System->Configuration->Developer.
Commenting out the profiler object AND reversing the change to php execution mode did the trick.
See attached for the proper virtualmin setting, found in Virtualmin->Server Configuration->Website Options

Resources