PHP multi-threading
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: PHP multi-threading

  1. #1
    Join Date
    Aug 2011
    Posts
    3

    PHP multi-threading

    I'm afraid that this might be a pretty noobie question,
    but I've been reading around the web that PHP doesn't really support multi-threading.

    Does that mean that if multiple users visit my website, and that makes many PHP scripts run that try to vie for the same resource/files, could there be deadlock and other related issues? Or is that different? Are there precautions I'm supposed to take?

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: PHP multi-threading

    It's a scripting language and therefore not a low-level language. Reading files will not be an issue at all. If you're writing to databases, there will be a queue which will process as resources free. If you're writing to the same file, then it will change to whomever edits first. So, you will need to put writing in your own locks.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Aug 2011
    Posts
    2

    Re: PHP multi-threading

    Multi-threading is not possible in PHP.

    However, it can be simulated as you suggest. I uncovered this article on it. But personally if you require multithreading, I'd say you are using the wrong software stack and maybe you need something a bit more powerful and suited to this kind of thing.

    If its just updates or background activity/checks etc, you could run it via a cron task. Without knowing more about the problem you are wishing to solve, its hard to make valid suggestions.

    Overseas consultants in India

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center