I have created a codeigniter app on a AWS with Lightsail that queries a large amount of data from an old magento database, converts into a new format, and pushes it to my new database.
The app works well and fine on my local machine under localhost, but when deploying to a AWS, I encounter a Gateway Timeout error. I believe this is because my local server is willing to wait longer for a response from another server than my AWS.
Is there any way to solve this error? Or rather, is there any way I can increase the amount of time my AWS is willing to wait for a response from my server database?
I tried this, but no dice:
set_time_limit(0);
error_reporting(E_ALL);
ob_implicit_flush(TRUE);
ob_end_flush();
I also tried this to no avail:
ini_set('max_execution_time', 0);
Both were placed in the constructor for my model. If either of these solutions do work, was that the wrong place to put the code?
EDIT: I should also mention that this is a Bitnami server running in Ubuntu.
2
Answers
For future generations, you need to edit timeout in the php-fpm-apache.conf. This is on the line
If you don't know where that is, just use
in the console. Mine happened to be located at /opt/bitnami/apache2/conf/
Be sure to restart apache and php-fpm with
And you'll be good to go!
In my case, I was seeing my "Remaining CPU burst capacity" graph reach zero.
The solution (found here) was to create a bigger size instance. To do this, create a snapshot, then on the snapshot select "create new instance", and choose a bigger size than I was using.
Then, as quoted from this blog
That fixed it for me.