The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 7 of 7

Thread: How to: PHP XMLSocketServer

  1. #1

    How to: PHP XMLSocketServer

    I want to create a chat like application with the help of PHP and Flash;

    I have searched a lot and looked the tutorial in kirupa also.
    I understood the working, code; but not the installation and setup;

    Most of them are for windows...

    My hosting service is Linux and my testing service is windows.

    Actually I need a very simple understandable code to test whether it is working in both my services. Then only I expand it to my needs.

    I have a doubt with that first line #!/usr/bin/php -q. How do I know what is to put here.
    And also localhost ip, address in both flash and PHP.

    Please help me. I really need this.. Some simple helps and if it is working I can try to do some extras..

  2. #2
    jwilliam's Avatar
    An intellectual carrot!
    That first line is called the "shebang." When you try to execute a script, the linux shell will look there to find out how the program should be invoked. In this case, it would see that line and start your script like so:

    /usr/bin/php -q your_script

    The -q stands for "quiet" and suppresses header output. I'm not entirely sure what you mean about the ip addresses. Your socket server will listen on an arbitrary port number, which (I believe) should be a non-standard port... something above 5000. Then your flash client would connect to your domain, or ip address, on that port and the server should hear it (ie, You'll probably have to open that port on your firewall as well.

  3. #3
    Thank you for your reply.

    How can we know whether it is supported by our hosting. In the phpinfo, it says Sockets enabled.

    I just uploaded a php socket script, and opened that file in my browser, the browser shows the first line, the 'shebang'.

    (I already chmodded it to 777.)

  4. #4
    jwilliam's Avatar
    An intellectual carrot!
    Do you have command line access to your server? Socket servers are daemons by nature, so you'll most likely want to start it from the command line. The idea is that once you start the server, it binds to port x and runs indefinitely, waiting for connection requests on that port. When it receives one, it forks a new process to serve that connection and keeps listening.

  5. #5
    I don't know if I have command line access.

    How do I check? I am using, byethost free hosting, I am using this for testing purposes..

    If this doesn't contain, I will get a new hosting account soon. And after that, how to start this script?

  6. #6
    jwilliam's Avatar
    An intellectual carrot!
    First make sure the script is executable, then do this:

    $ /path/to/script/socket_server &

    To see if your socket server is still running:

    $ ps -Al | grep socket_server

    ... where "socket_server" is the actual name of your script. Google around a bit and you'll find plenty of info on basic linux shell commands and best practices. Good luck!

  7. #7
    Thank you
    I am trying this..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012