I’ve been able to successfully move almost everything from Heroku over to DigitalOcean, and it’s been working great.

The last piece that I’m having trouble finding documentation on is Heroku Workers. I’m able to create workers within their Procfile like this:

web: vendor/bin/heroku-php-apache2 www/
workerA: php bin/example-file1.php
workerB: php bin/example-file2.php

The scripts in the workers can run longer than the 30 second maximum imposed by Heroku for longer running tasks.

I’m unsure how to replicate this in DigitalOcean, and searching “worker” doesn’t really help.

Could anyone point me in the right direction?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @lorkel,

Happy to hear that it is all working well for you so far!

What you could do is to just adjust your PHP max_execution_time via your php.ini file.

If you are running those PHP scripts via your command line, you could find the location of your php.ini by running the following command:

  • php -i | grep php.ini

Then open the file and adjust the max_execution_time value.

If those scripts are triggered via your browser, then you could create a PHP info file:

info.php
<?php

    phpinfo();
?>

Then visit that via your browser and with CTRL+F search for php.ini. Once you find that location again as before open the file and adjust the max_execution_time value.

After that you would need to restart Apache so that this new value takes effect:

  • sudo systemctl restart apache2

Hope that this helps.
Regards,
Bobby

  • Thanks for the response, Bobby! So just to confirm, I should plan to run these in the same droplet and just increase the execution time as needed?

    • Hi there @lorkel,

      Yes, that would be one way to go, have all of the scripts on one Droplet, and just increase the execution time.

      On another note, you could plan to deploy each script on a separate Droplet and again adjust the execution time individually on each Droplet. That way the scripts would not affect each other, but this of course depends on what exactly the scripts are doing and if they depend on each other.

      Hope that this helps!
      Regards,
      Bobby

Submit an Answer