Skip to Content

Internal server error

How to solve error Error: An error occurred while communicating with the server (error: Internal Server Error)

 

This error usually occurs because the maximum execution time for PHP scripts has been exceeded. By default, PHP scripts are allowed to run for a certain amount of time.

Follow the below steps to resolve the issue

1. Check the latest application logs for the errors  

Run the following command to navigate to the log directory and tail the latest logs.

root@jumpserver:~# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/

root@jumpserver:/var/www/ezlogin/application/logs# tail -f <the latest log file>

For Example

root@jumpserver:~# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/

root@jumpserver:/var/www/ezlogin/application/logs# tail log-2024-03-23.php -f

ERROR - 2024-03-25 11:28:54 --> Severity: Error --> Maximum execution time of 30 seconds exceeded /var/www/ezlogin/application/third_party/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php 2097941

Since the maximum execution time of 30 seconds has been exceeded in this case, the issue can be resolved by increasing the max_execution_time limit.

2. Increase PHP Execution Time

Increase the maximum execution time for PHP scripts by modifying the max_execution_time limit in your php.ini file.

root@jumpserver:~# nano /etc/php/8.1/apache2/php.ini ---> (change into corresponding PHP version)

max_execution_time = 300

3. After making the changes restart Apache web service.

root@jumpserver:~# systemctl restart apache2

4. To confirm check the php.ini file

root@jumpserver:~# grep -v '^\s*#' /etc/php/8.1/apache2/php.ini | grep -i max_execution_time
max_execution_time = 300