LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2014, 02:59 PM   #1
biggreennmean
LQ Newbie
 
Registered: Apr 2009
Location: Piqua, Ohio, USA
Distribution: Slackware 14
Posts: 5

Rep: Reputation: 0
Question PHP5 sockets for use in websites, need advice...


In case it matters...

Running Slackware14 out of the box and using:

-PHP 5.4.7 (cli) (built: Sep 14 2012 14:44:02)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

-Server version: 5.5.27 MySQL Community Server (GPL).

Hello everyone,

Before I begin, my experience is:
*Linux user - 12 years
*HTML - 10 years
*PHP + MySQL on an Apache server - 4 years (on and off when I have ideas I want to explore)
*Javascript - Hate it and just use simple things when I have to and usually have to do a refresher course every time before I start using it but I attempted to learn it when I learned HTML.
*Anything to do with sockets and HTML5 - a little over a week.

side note: Was without a computer for about 3 years until a couple months age when I rehabbed this old dell and rescued it from XP Home Edition.

As you can see I am a simple n00b hobbyist and learned everything from online tutorials and examining other people's work.

ON TO THE MEAT...

I am involved in a personal project in learning real time PHP web development. The project I have designed for this experience is a social network site. Among other things I was wanting to create a full duplex real time chat and instant message system, a multi-user real time white board, and some other things using sockets in PHP that will load into the body of a web page "as it happens".

I wish to code all of it from scratch using nothing but PHP5, MySQL5.5, HTML5, and probably a touch of Javascript so I don't want to use things such as node.js or socket.io but rather create my own libraries of classes and functions to handle the stream data (again, this is for learning and easy doesn't teach you anything).

From reading tutorials I have been able to successfully make an echo server that I could telnet into with multiple users and have done some neat things with that but after that is where I get lost.

Once I have the socket server running, how do I connect to it through a web browser for the purpose of real time chat and stuff in my web pages, or can I even do it like that? If I cannot can you please tell me a better direction

I have no problem using PHP to connect to a MySQL database and for dynamic web pages and such but I have never done anything with sockets before about a week ago, much less in PHP. Can anyone please direct me to a How To or Tutorial that explains how to take this to the next level?

BTW, I do have some code that creates the socket server. If anyone thinks it useful I will post it here for your review but in all honesty, at least on this occasion, I doubt that it would influence anything moving forward. It is very simple and less than 30 lines of code.

Lastly, I know that there are better technologies out there for running socket servers. I could just as easily (probably more so) use C++ (I am at about the same level with C++ as I am with PHP) to do the exact same thing but this is what I have chosen to work with. Please respect that and don't try to convince to alter my overall goal of learning how to use sockets with PHP5. I am already aware of these alternatives.

As always, Thank everyone in advance for any and all help you may have to offer.
 
Old 01-05-2014, 11:03 AM   #2
biggreennmean
LQ Newbie
 
Registered: Apr 2009
Location: Piqua, Ohio, USA
Distribution: Slackware 14
Posts: 5

Original Poster
Rep: Reputation: 0
Been thinking...

Had a thought but I am not sure how valid the idea is or how to implement it if it is valid.

Is there a way to use Apache as a sort of socket bridge between a PHP socket server and a browser to establish real time full duplex communication between the two? Or would it be more likely that the socket server open a socket for Apache and a browser to communicate in real time across? As you can see my education in these matters is lacking and I desperately want to understand this.

I'm trying to dog paddle through some deep water here and almost anything that would give me a clue as to which direction I should take from here would be oh so appreciated. I know how to do everything I need to make this project come together minus how to make it in real time using PHP sockets (I think anyway. If not I will learn what I don't know as I realize I don't know it.).
 
Old 01-10-2014, 12:24 AM   #3
biggreennmean
LQ Newbie
 
Registered: Apr 2009
Location: Piqua, Ohio, USA
Distribution: Slackware 14
Posts: 5

Original Poster
Rep: Reputation: 0
Nothing?

Did I do something wrong? Not even a single reply (besides the one's I've made)?
 
Old 01-15-2014, 12:00 AM   #4
biggreennmean
LQ Newbie
 
Registered: Apr 2009
Location: Piqua, Ohio, USA
Distribution: Slackware 14
Posts: 5

Original Poster
Rep: Reputation: 0
Angry Thanks for nothing!

I thought this to be a reputable place but I was wrong. I am ashamed to say I have received help from a Windows user. You people should be ashamed also. I will never again direct someone to LinuxQuestions.org as I have so many times in the past. I will not soil my reputation or sacrifice the good name of Linux again with your site.

I found my answers, no thanks to anyone here. The answer is Websocket! That is all someone would have had to say to save me over a week of anxiety aimlessly scouring the internet for answers (and I don't mind doing that kind of leg work, I don't want anyone doing things for me, but a freakin' hint would have been really nice). I don't know what else to say other than I am embarrassed for you. If you people were 1/100 the quality and integrity that Linux is you would have at least had the balls to either say you don't know or admit you don't care enough to help. But that's your problem, not mine. I have gained my answer but you have lost my patronage and any and all referrals I would have made.
 
  


Reply

Tags
php5, sockets, web browser



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple virtual machines hosting websites - advice please doahh Linux - Virtualization and Cloud 7 01-25-2011 03:02 PM
Apache2 won't serve php5 in home directory, need advice floweringmind Linux - Software 4 05-21-2010 11:29 AM
Help/advice needed for gateway for multiple websites w/ email servers zogthegreat Linux - Networking 2 04-22-2010 05:36 AM
Program to forward tcp sockets to unix domain sockets mikepol Linux - Networking 0 09-27-2007 09:49 AM
PHP5 binary with enable-sockets OliXNet Linux - Newbie 1 11-16-2006 01:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration