Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Synchronization in PHP ??

Question posted by: Hermann (Guest) on March 17th, 2008 03:55 AM
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...

Thanks in advance.
Regards.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
petersprc's Avatar
petersprc
Guest
n/a Posts
March 17th, 2008
05:25 AM
#2

Re: Synchronization in PHP ??
PHP has an interface to SysV semaphores:

http://www.php.net/manual/en/function.sem-acquire.php

flock is also available for file-based inter-process synchronization.

On Mar 16, 11:52 pm, Hermann <Hermann.Rich...@gmail.comwrote:
Quote:
Originally Posted by
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...
>
Thanks in advance.
Regards.



Jerry Stuckle's Avatar
Jerry Stuckle
Guest
n/a Posts
March 17th, 2008
11:15 AM
#3

Re: Synchronization in PHP ??
Hermann wrote:
Quote:
Originally Posted by
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...
>
Thanks in advance.
Regards.
>


What kind of synchronization are you trying to do?

In general, PHP scripts don't talk to each other like they can in other
languages. There is a limited interface, but it's system dependent. So
there are some things you *can* do in PHP, but PHP may not necessarily
be the *best* language to do them in.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
Join Bytes!
==================


The Natural Philosopher's Avatar
The Natural Philosopher
Guest
n/a Posts
March 17th, 2008
11:55 AM
#4

Re: Synchronization in PHP ??
petersprc wrote:
Quote:
Originally Posted by
PHP has an interface to SysV semaphores:
>
http://www.php.net/manual/en/function.sem-acquire.php
>
flock is also available for file-based inter-process synchronization.
>
On Mar 16, 11:52 pm, Hermann <Hermann.Rich...@gmail.comwrote:
Quote:
Originally Posted by
>Does exist any form of synchronization in PHP??
>Namely locks, mutexes, semaphores, monitors, etc...
>>
>Thanks in advance.
>Regards.

>

and if interfacing to Mysql, there are lock facilities in that.


The Natural Philosopher's Avatar
The Natural Philosopher
Guest
n/a Posts
March 17th, 2008
11:55 AM
#5

Re: Synchronization in PHP ??
Jerry Stuckle wrote:
Quote:
Originally Posted by
Hermann wrote:
Quote:
Originally Posted by
>Does exist any form of synchronization in PHP??
>Namely locks, mutexes, semaphores, monitors, etc...
>>
>Thanks in advance.
>Regards.
>>

>
What kind of synchronization are you trying to do?
>
In general, PHP scripts don't talk to each other like they can in other
languages. There is a limited interface, but it's system dependent. So
there are some things you *can* do in PHP, but PHP may not necessarily
be the *best* language to do them in.
>


Quite.

If you have some heavy realtime interactive-across-many-web-interfaces
type problem, the better answer is to use php to do the user interface
parts, and have some core daemon written in 'C" or suchlike handling all
the interactivity bits.

And write a PHP extesnion to access it.



Hermann's Avatar
Hermann
Guest
n/a Posts
March 17th, 2008
05:45 PM
#6

Re: Synchronization in PHP ??
Alright guys. Perfectly clear. Thank you all by your replies.

I just need to do an atomic test-and-set in a MyISAM table (a global
shared variable for the whole website).
But I think it would be better if I use a shared variable. Those that
are provided by php caching packages.
Actually, I read that eAccelerator has a lock function in its API, so
that would be perfect.

 
Not the answer you were looking for? Post your question . . .
183,943 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors