Hi Everyone,
I have performed a new installation of Magento 2.4.6-p3 on CentOS7, using apache and php8.2.0 and using composer method, performed the required following steps (permissions, etc) but once I try to access, I have the common 500 Internal Server Error in return.
Have renamed the .htaccess and then I get a "Forbidden you don't have permission to access this resource".
Have tried multiple permission options and it never works. Any hint would be appreciated.
Solved! Go to Solution.
Found the problem:
the .htaccess on pub folder does have +FollowSymLink but replacing it with SymLinksIfOwnerMatch ir works.
Enable error display:
init_set('display_errors',1);
in pub/index.php and see what's wrong.
Also, study var/log/system.log and var/log/exception.log for any warnings/errors.
Thanks @konstantina904 . Where should I see the logs/info generated by the init_set? Because when I set those, I can't see anything different on the page returned:
"The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at ******** to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log."
It appears to me that it is not even reaching up the index.php file
Hi @CarpoPT,
A 500 Internal Server Error in Magento 2.4.6-p3 on CentOS 7 can be caused by various issues, and diagnosing the problem requires examining server logs and checking different aspects of your Magento installation. Here are some steps you can take to troubleshoot and resolve the issue:
Examine the Apache or Nginx error logs. On CentOS 7, Apache logs are typically located in /var/log/httpd/error_log, while Nginx logs are in /var/log/nginx/error.log. Look for any error messages that might indicate the cause of the 500 error.
Magento has its own logs that can provide insights. Check the var/log directory within your Magento installation. Look specifically at the system.log and exception.log files for any error messages.
Switching Magento to developer mode can provide more detailed error messages. You can do this by running the following command in the Magento root directory.
Php bin/magento deploy:mode:set developer
After enabling developer mode, try reproducing the error and check the logs again for more detailed information.
Ensure that file and directory permissions are set correctly. Magento requires specific permissions for different directories and files. You can find the recommended permissions in the Magento documentation.
Review the PHP error logs, which are often located in /var/log/php-fpm/ or /var/log/php_errors.log. Look for any PHP-related errors.
Check if the PHP memory limit is sufficient for Magento. You can increase the memory limit by modifying the php.ini file or using the .htaccess file if you're using Apache.
Ensure that Magento can connect to the database. Verify the database credentials in the app/etc/env.php file.
If compilation is enabled, try disabling it by running the following commands:
bin/magento module:disable Magento_Compiler
bin/magento setup:upgrade
bin/magento cache:clean
Disable third-party extensions one by one to identify if any extension is causing the issue.
Reindex your Magento store by running:
bin/magento indexer:reindex
Clear the Magento cache by running:
bin/magento cache:clean
also you can try the .htaccess on pub folder does have +FollowSymLink but replacing it with SymLinksIfOwnerMatch it will work.
If the issue will be resolved, Click Kudos & Accept as a Solution.