cancel
Showing results for 
Search instead for 
Did you mean: 

500 Response on browsing to fresh install of Magento 2

500 Response on browsing to fresh install of Magento 2

centos/PHP 5.6/Apache

 

error log:

 

PHP Fatal error:
Uncaught exception 'RuntimeException' with message
'The specified "/var/www/html/magento/var/generation/Magento/
Framework/App/ResourceConnection/Proxy.php.15509"
file could not be written
Warning!file_put_contents(/var/www/html/magento/var/
generation/Magento/Framework/App/ResourceConnection/Proxy.php.15509):
failed to open stream: Permission denied' in /var/www/html/magento/vendor/
magento/framework/Code/Generator.php:115\nStack trace:\n#0
/var/www/html/magento/vendor/magento/framework/Code/Generator/
Autoloader.php(35): Magento\\Framework\\Code\\
Generator->generateClass('Magento\\\\Framewo...')\n#1 [internal function]:
Magento\\Framework\\Code\\Generator\\
Autoloader->load('Magento\\\\Framewo...')\n#2
[internal function]: spl_autoload_call('Magento\\\\Framewo...')\n#3
/var/www/html/magento/vendor/magento/framework/Code/Reader/
ClassReader.php(19): ReflectionClass->__construct('Magento\\\\Framewo...')\n#4
/var/www/html/magento/vendor/magento/framework/ObjectManager/
Definition/Runtime.php(44): Magento\\Framework\\Code\\Reader\\
ClassReader in /var/www/html/magento/vendor/magento/framework/Code/
Generator.php on line 115

7 REPLIES

Re: 500 Response on browsing to fresh install of Magento 2

Hi @nickPostma,

 

It seems like a permission problems.

Maybe the owner of files isn't the same user than webserver. Is it possible?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: 500 Response on browsing to fresh install of Magento 2

Reconfigured owner of files to be the nobody user, gave them full permissions. now I see this error:

 

PHP Fatal error: Uncaught exception 'Zend_Cache_Exception' with message 'cache_dir "/var/www/html/magento/var/page_cache" is not writable' in /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Cache.php:209\nStack trace:\n#0 /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')\n#1 /var/www/html/magento/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')\n#2 /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)\n#3 /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)\n#4 /var/www/html/magento/vendor/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/magento/vendor/magento/framework/App/Cache/Fr in /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

 

Could you please provide the ideal user setup, with permission configuration?

Re: 500 Response on browsing to fresh install of Magento 2

@nickPostma,

 

Here you'll find the information you're looking for: http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-sys-perms-over.html

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: 500 Response on browsing to fresh install of Magento 2

Thank you! I added a new user and added them to the apache users group and gave ownership of the docs to that group and I got past the error

Re: 500 Response on browsing to fresh install of Magento 2

Great!

 

Can you mark the answer that help you to get the solution? (in order to help future users with the same problem).

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: 500 Response on browsing to fresh install of Magento 2

Retested and it's still not working, 

permissions are set 777 for all files under magento directory,

user group apache owns the files and magento_user belongs to that group...

 

What am I missing?

Re: 500 Response on browsing to fresh install of Magento 2

Can you check if users and group has the same level of perrmissions?

Can you show the permissions and owners of a few files with both users?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"