When e.g. updating WordPress, it often happens that the download takes longer than the default 30 second PHP timeout and so the upgrade cannot be completed. The workaround is to increase the timeout (temporarily), which is done by editing the max_execution_time variable in the php.ini file which is located in the php/ directory. 300 seconds is usually enough.
For this to have an effect, it is probably necessary to restart the Apache server.
And don’t forget to revert to 30 seconds once the WordPress upgrade (or whatever slow process) is done.