Jump to content

Recommended Posts

Would it be possible to create a passive socket server using php, for a client-server php app, that runs as some sort of daemon?

 

I understand that you probably can't understand much of what I mean, but I hope you understand enough to help me in some way.

 

PHP APPLICATION - > APPLICATION SERVER - > DATABASE(S)

 

ideag.png

 

Explanation:

 

Each instance of the PHP application would connect to the "Application Server" and use it to fetch information and perform some commands.

 

Could this be done using sockets ?

Simple examples would help :)

 

Thank You!

 

Link to comment
https://forums.phpfreaks.com/topic/212554-php-custom-application-server/
Share on other sites

Yes it's possible to let PHP run as a "daemon" using the command:

 

set_time_limit(0);

 

However as PHP is not designed for such applications it may be best to look for other technologies that better fit the bill like Flash. The new ActionScript comes with socket server support like ElectroServer (which is specifically designed for hosting Flash-based MMO games). The same company (ElectroTank) also released a book explaining every bit you need to get your own game up and running (ActionScript for Multiplayer Games and Virtual Worlds).

As ignace stated, yes it is possible. For the client you would need to use HTML5 websockets, which aren't implemented, or fully implemented, in most browsers, yet.

 

It's also worth noting that from personal experience I've learned that using PHP for a socket server scales horribly; even at a fairly low level.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.