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
Best Answer
sudo chmod -R 777 /var/www/html/magento
sudo chmod -R 777 /var/www/html/magento
export PATH=$PATH:/var/www/html/magento/bin
crontab -u -e
example
crontab -u harish -e
select nano editor. add the following lines at the end of the file
where
is the absolute file system path to your PHP binary 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&
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