Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

429
Views
PHP exec() is very slow on AWS EC2-server

I am running a service that holds a large number of cronjobs (1000+).

The list of cronjobs can be updated multiple times a day. First I update a .txt-file with a list of cronjob-commands like this:

echo -e "`crontab -l`\n1 21 * * 1-5 /usr/bin/php /var/www/html/file_to_be_called.php 123" | crontab - 

And when the .txt-file is updated, I run a PHP-script that takes the .txt-file and executes it as commands like this:

$list_of_cronjobs = file_get_contents("../list_of_cronjobs.txt");
exec($list_of_cronjobs);

This all works fine but the problem is the execution time of this setup. The exec($list_of_cronjobs);-line takes about 20 seconds with ~1000 lines in the .txt-file. This is alright for now but I expect to add more than 5000 lines of cronjobs within the next months and then the execution-time is a problem.

I'm curious how to improve and speed up this process. My script is running on an AWS EC2 server (t2.medium). Any suggestions to boost the exec()-process?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!