skip to Main Content

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


  1. Chosen as BEST ANSWER

    For future generations, you need to edit timeout in the php-fpm-apache.conf. This is on the line

    <Proxy "unix:/opt/bitnami/php/var/run/www.sock|fcgi://www-fpm" timeout=900>
    

    If you don't know where that is, just use

    sudo find / -iname php-fpm-apache.conf
    

    in the console. Mine happened to be located at /opt/bitnami/apache2/conf/

    Be sure to restart apache and php-fpm with

    sudo /opt/bitnami/ctlscript.sh restart php-fpm
    sudo /opt/bitnami/ctlscript.sh restart apache
    

    And you'll be good to go!


  2. 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

    Once done, go to your static IP and edit it to point to a new instance rather than the old instance.

    That fixed it for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search