Home > Article > PHP Framework > What should I do if Alibaba Cloud reports a 500 error when building laravel?
Recently, when I was using Alibaba Cloud's virtual host to build a Laravel application, I encountered a difficult problem: 500 error.
First of all, I made sure there was no problem with my code because the local environment test passed. I also tried debugging on the server, but found no obvious errors.
So, I started to troubleshoot the problem step by step.
In the first step, I checked the Apache error log and found this error: ModSecurity: Access denied with code 403. This reminds me of Alibaba Cloud's Web Application Firewall (WAF).
In the second step, I logged into the Alibaba Cloud management console and found that WAF was indeed enabled. It may have interfered with my application.
In the third step, I disabled WAF, but the problem still exists.
The fourth step, I started to check the PHP error log and found this error: PHP Fatal error: Call to undefined function openssl_random_pseudo_bytes().
This error indicates that I need to install the OpenSSL extension. So, I installed OpenSSL using the following command:
sudo apt-get install openssl
Then, I restarted the Apache and PHP-FPM services:
sudo service apache2 restart
sudo service php7.1-fpm restart
Finally, I successfully solved the 500 error problem!
Summary
When using Alibaba Cloud's virtual host to build a Laravel application, you may encounter a 500 error. If there is no problem with your code itself, you can solve the problem by following these steps:
I hope this article will help you solve the Alibaba Cloud Laravel 500 error problem!
The above is the detailed content of What should I do if Alibaba Cloud reports a 500 error when building laravel?. For more information, please follow other related articles on the PHP Chinese website!