8
uuid
7y

Daaamn! I needed to process some data simultaneously using PHP, so I thought of using Threads to make things faster, checked out SO and discovered that the available Thread class can only be used in cli environment not on a web server ... FML 😑.
It's like these moments that I remember why I hate PHP, and regret accepting this job.

I miss Java 😣😣

Comments
  • 1
    Use redis pubsub as event bus

    And use a queue system in Java to listen for processing request, create jobs and process them later on in a threaded manner

    I dod the same with some heavy lifting long runing task except the processor itself is written in nodejs
  • 2
    Laravel has support for background tasks using message queue

    I used it a couple of years back to push notifications and send emails in background and reply to the user as soon as the job is saved in the queue
  • 1
    @benderRodriguez I have a tight deadline to deliver this task but I'll surely check out your suggestion of using redis later.
    I'm using symfony not laravel.
  • 3
    It's not exactly multithreading (honestly, I still struggle with the concept) but there's Gearman.

    http://php.net/manual/en/...
  • 2
    @scytheri0n Oh seems promising, I didn't know this extension existed. Thanks man.
  • 2
    @rising glad I could help (: now to just remember it when I jump back on the issue I originally needed it for and haven't had chance to fix!
Add Comment