Topic: The best way to run PHP app as serverlet?

I have a PHP application that acts as a chat server (socket programming), and clients will connect via XMLSocket. What is the best way that to keep my chat server run continuously? and can start or stop this server from client applications? Thanks!

Today is the tomorrow you worried about yesterday, and all is well. smile
FluxBB in Chinese.

Re: The best way to run PHP app as serverlet?

php /path/to/script.php &

That should do.

Ben
SVN repository for my extensions - The thread
Quickmarks 0.5
“Question: How does a large software project get to be one year late? Answer: One day at a time!” - Fred Brooks

Re: The best way to run PHP app as serverlet?

Thanks elbekko!
Could you please explain in more details about this command? When, where and how should i execute this command? Thanks!

Today is the tomorrow you worried about yesterday, and all is well. smile
FluxBB in Chinese.

Re: The best way to run PHP app as serverlet?

Well, it's a *nix shell command. It calls up the PHP interpreter, tells it which file to execute, and then tells it to do this in the background.
If you want to stop it, you just use the kill command, together with the process ID you can see from doing ps -ef or similar.

Ben
SVN repository for my extensions - The thread
Quickmarks 0.5
“Question: How does a large software project get to be one year late? Answer: One day at a time!” - Fred Brooks

Re: The best way to run PHP app as serverlet?

Hmmmm. Then if the server is Windows, what should I do?

Today is the tomorrow you worried about yesterday, and all is well. smile
FluxBB in Chinese.

Re: The best way to run PHP app as serverlet?

php.exe is installed on your windows machine when you install php, so the above will work fine.  Double-check that your install directory (by default is c:\program files\php) is in your environment path.

(Alternatively, you can run it as a windows service.  See this blog for ideas:
http://netevil.org/blog/2005/sep/runnin … e-on-win32)

Last edited by eliot (2008-08-16 00:50:50)

Re: The best way to run PHP app as serverlet?

Hi eliot.
Thanks. I will look into it.

Last edited by frozen_space (2008-08-16 00:52:48)

Today is the tomorrow you worried about yesterday, and all is well. smile
FluxBB in Chinese.