I followed the tutorial and successfully installed Magento 2.4.7 twice today, but the website does not work. I’m not sure where I went wrong and how to fix this.
https://www.linuxtuto.com/how-to-install-magento-2-4-7-on-ubuntu-24-04/
This page isn’t working right now http://www.123456.com can’t currently handle this request. HTTP ERROR 500
I Fix the File Permissions. Like this, https://www.cloudways.com/blog/magento-500-error/
find . -type f -exec chmod 644 {} \; find . -type d -exec chmod 755 {} \; find ./var -type d -exec chmod 777 {} \; find ./pub/media -type d -exec chmod 777 {} \; find ./pub/static -type d -exec chmod 777 {} \; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml chmod u+x bin/Magento
Now, the website shows the following error.
UnexpectedValueException: The stream or file "/var/www/magento//var/log/system.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/magento//var/log/system.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: Broken reference: the 'tracking' element cannot be added as child to 'header', because the latter doesn't exist in /var/www/magento/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:149 Stack trace: #0 /var/www/magento/vendor/magento/framework/Logger/Handler/Base.php(98): Monolog\Handler\StreamHandler->write() #1 /var/www/magento/vendor/magento/framework/Logger/Handler/System.php(65): Magento\Framework\Logger\Handler\Base->write() #2 /var/www/magento/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Magento\Framework\Logger\Handler\System->write() #3 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(399): Monolog\Handler\AbstractProcessingHandler->handle() #4 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(650): Monolog\Logger->addRecord() #5 /var/www/magento/vendor/magento/framework/Logger/LoggerProxy.php(140): Monolog\Logger->error() #6 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(269): Magento\Framework\Logger\LoggerProxy->error() #7 /var/www/magento/pub/index.php(30): Magento\Framework\App\Bootstrap->run() #8 {main}
Hello @Modest,
Seems like issue is with web server user.
Make sure the web server user and group is same as files.
You can add below line in pub/index.php :
echo exec('whoami');
exit;
It will show you the web user, compare with files user and group.
if the web user is www-data, you should change it to as per your file system.
I hope it helps.
Hello @Modest,
The error you're facing indicates that there is a file permission issue preventing Magento from writing to the log files, specifically /var/log/system.log. Here's how to troubleshoot and resolve the issue:
To resolve this, you'll need to adjust the permissions for the var/log directory so that Magento can write to it. Here's what you can try:
1 : Fix Permissions for Log Directory:
Ensure that the log directory (/var/www/magento/var/log/) has the correct permissions, allowing Magento to write to the log files. Run the following commands:
sudo find /var/www/magento/var/log/ -type f -exec chmod 664 {} \; sudo find /var/www/magento/var/log/ -type d -exec chmod 775 {} \; sudo chown -R www-data:www-data /var/www/magento/var/log/
2: Correct File Permissions Across the Project: Since Magento requires specific permissions for its directories, ensure that other key directories are also writable:
sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; sudo chown -R :www-data /var/www/magento/ sudo chmod u+x bin/magento
After this all the magento commands:
php bin/magento s:up php bin/magento s:d:c php bin/magento s:s:d -f php bin/magento c:f
After This you will not face this issue anymore.
If the issue will be resolved, Click Kudos & Accept as a Solution.