We are working on a magento 2 project. Since Windows lack cron job, magento 2 refused work full fledged. We decided to install ubuntu.
After striving hard I was able to make PHP7, apach2, mySQL and phpmyadmin work. Now the next hurdle is Magento. It says
The localhost page isn’t working
localhost is currently unable to handle this request.
500
After hours of struggle I still have no idea on how to make it work.
Edit: I created a folder in var/www/html/Magento2 and copied all magento 2.02 files which has support for PHP7. Then I visit the Magento2 url. Bang I get the above error.
I need to confirm again PHP7 is working fine. Other scripts are working. I can even check for phpinfo. All the modules listed in the comment are installed.
PHP error log
[Sat Mar 12 10:09:29.489176 2016] [:error] [pid 1380] [client 127.0.0.1:44524] PHP Fatal error: Uncaught Magento\Framework\Exception\LocalizedException: Can't create directory /var/www/html/Magento2/var/generation/Magento/Framework/App/ResourceConnection/. in /var/www/html/Magento2/vendor/magento/framework/Code/Generator.php:103\nStack trace:\n#0 /var/www/html/Magento2/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/Magento2/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\\Framewo...')\n#4 /var/www/html/Magento2/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\\Framewo...')\n#5 /var/www/html/Magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runt in /var/www/html/Magento2/vendor/magento/framework/Code/Generator.php on line 103
-
I rechecked for the magento2 requirements and installed the following extensions, still not working, - curl, gd, ImageMagick 6.3.7 (or later), intl, mbstring, mcrypt, mhash, openssl, PDO/MySQL, soap, xml, xsl, zipHarish Ninge Gowda– Harish Ninge Gowda2016年03月11日 12:42:44 +00:00Commented Mar 11, 2016 at 12:42
-
check php error logMagenX– MagenX2016年03月11日 14:07:01 +00:00Commented Mar 11, 2016 at 14:07
-
Can you elaborate on when you get this error? When you first load magento after or before installation? Any errors in apache logs? also as @MagenX mentioned any errors in php error log? Also, how did you deploy? via composer-create project, downloaded zip from magento.com or via git clone?Maddy– Maddy2016年03月11日 14:26:05 +00:00Commented Mar 11, 2016 at 14:26
-
Looks like directory permission exception. Can you check the httpd's error log to get the more details ?iPragmatech Solutions Pvt Ltd.– iPragmatech Solutions Pvt Ltd.2016年03月11日 18:34:08 +00:00Commented Mar 11, 2016 at 18:34
-
I get this error when I visit the URL for installation.Harish Ninge Gowda– Harish Ninge Gowda2016年03月12日 04:40:04 +00:00Commented Mar 12, 2016 at 4:40
4 Answers 4
Download magento2 from Magento Commerce website
Create a folder magento under
/var/www/htmlExtract all the files of magento2 under
/var/www/html/magentoChange the file permissions
sudo chmod -R 777 /var/www/html/magentoCreate a database called magento
Visit website url to install magento2
After completing installation change the directory permission again
sudo chmod -R 777 /var/www/html/magentoSet environmental variables in ubuntu
export PATH=$PATH:/var/www/html/magento/binSetting up cron
crontab -u <ubuntu_user_name> -e
Example:
crontab -u harish -e
Select nano editor.
Add the following lines at the end of the file
*/1 * * * * <path-to-binary> -c <ini-file-path> <your Magento install dir>/bin/magento cron:run > */1 * * * * <path-to-binary> -c <ini-file-path> <your Magento install dir>/update/cron.php > */1 * * * * <path-to-binary> -c <ini-file-path> <your Magento install dir>/bin/magento setup:cron:run >
Where:
<path-to-binary> is the absolute file system path to your PHP binary
<ini-file-path> is the path to a php.ini file to use for the cron job
Example:
*/1 * * * * /usr/bin/php7.0 -c /etc/php/7.0 /var/www/html/magento/bin/magento cron:run > /var/www/html/magento/var/log/magento.cron.log&
*/1 * * * * /usr/bin/php7.0 -c /etc/php/7.0 /var/www/html/magento/update/cron.php > /var/www/html/magento/var/log/update.cron.log&
*/1 * * * * /usr/bin/php7.0 -c /etc/php/7.0 /var/www/html/magento/bin/magento setup:cron:run > /var/www/html/magento/var/log/setup.cron.log&
Run cron from the command
magento cron: run
I have explained the step by step installation of magento2 on ubuntu 14.04 with php7 in this post. It could help someone at least. Installing Magento2 on ubuntu with php7
Please go through below links for directory and file:
http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache-user.html
Hope this will help you for proper file/directory permissions.
-
The quide suggests 770 permission. But this is not working.Harish Ninge Gowda– Harish Ninge Gowda2016年03月12日 05:35:21 +00:00Commented Mar 12, 2016 at 5:35
-
755 permission works fine.Harish Ninge Gowda– Harish Ninge Gowda2016年03月12日 05:36:14 +00:00Commented Mar 12, 2016 at 5:36
-
Its because of files/directory
ownership, kindly update it with appropriate user/groups. It should be after do so.Jayesh Patel– Jayesh Patel2016年03月12日 05:37:31 +00:00Commented Mar 12, 2016 at 5:37
we have installed magento2 on centos with php7 mariadb apache2 and nginx as proxy server with varnish redis and memcached also installed google page speed module. it is working fine except for suhosin which is required by our web panel i.e.. sentora. your problem seems to be broken installation. if you are using ubuntu is it clear that you first done a minimal install. and then installed everything. as if the default php and apache versions are still there it won't work as expected. post your detailed install process we might help.
Gone through your installation script. You have configured sites available in Apache. But I don't see where it configures sites enabled in Apache. Make sure that the site enabled configuration of Apache includes your Magento installation.