How to automatically start and keep socket.io instance in server - html

I have been developing a chat application using socket.io on Ubuntu and it needs to be run manually using the command line prior to test it on browser.
I am a PHP developer and how am I supposed to run the application on the server side without putting hands on the terminal?
Furthermore after executing the .js file via command line, I can test the application typing the host and a port typed on in the address bar. How can I overcome that if I am to embed the chat on a PHP page? Currently it looks like an external application.
The socket.io chat uses a .html page to draw the interface. How can I embed it in a PHP file?
Please help.

Related

Getting a Linux terminal output of a CLI tool and displaying in Web page

I am trying to create a web application using python which has a HTML form and the form data is used as a command line input to start an application. I know how to initiate the CLI tool from web app, but want a way to get the output of the CLI tool from Linux terminal real time and show it in the web application.
The CLI tool will run for a day and the terminal output will change in real time. Is there a way to display the changing Linux terminal output in to the web application. Information about any web terminal or way to get and store the real-time screen output of a linux application will be helpful.
When ever the screen O/P of the application running in linux changes then the web application should also be updated with the change.
Any python lib or tools will be useful and easy to Integrate?
A quick solution I would do (without any libraries or stuff):
invoke your CLI program and set it up to continuously output to a file on the server. Make sure you know the file name.
use Ajax calls to fetch the output to the client. OR (if you are in for hard stuff) use a webSocket to output to the client.

How to deploy service based web apps on apache in linux?

So i have a Linux based Server having webmin
And i made an web application having some css/js and a html and i put that folder in var/www/html/TestAPI
installed Apache Web server and every other module recommended
My question is ,how do i make this run as a service,like when i ping the HTML inside this folder it opens up but doesnt load any js/css
How do i execute this when i just open TestAPI
eg:- http://11.11.11.11/TestAPI
(Tried using index.html)
I dont want to use php
Any Help would be deeply appreciated

Building a web page without having internet access

I want to build a web site using my laptop in areas where I often do not have internet access - no active browser. How do I check my pages to see how things are going without a browser?
Just drag-and-drop the .html file into your favourite web-browser. It should open up with the "file:///" protocol automatically.
You should always have a local web server installed on your machine for development.
For example, Mac OSX comes with Apache pre-installed. You might have to activate it. You can also install a server language like PHP or Python. Again, OSX comes with those pre-installed, might just need activation. Google how to set up a local server on the type of OS you have.
You should try to replicate the type of server setup you will be using in production.
That will permit you to code locally and test in your browser.
You should also use some kind of versioning system like Git. So, you code on your local machine, then you can push your code to the cloud once in a while for backup. When you're ready, upload your code to the production server and try it out.

How to access server MySQL database from iOS app

I'm trying to write an iOS app using Xcode.
A simple login prompting username and password.
I have no idea how to open a database connection to validate the username and password.
The database I use is mysql.
I tried using this link http://macbug.org/macosxsample/mysql#.Ur8AYBbtGPF
but I get an error when I tried to add libmysqlclient.a to the frameworks and library.
If your database is on a server somewhere, then you would generally not have your iOS app interact directly with the database server, but rather you would write a web service that the app would interact with (via NSURLConnection, NSURLSession or something like AFNetworking), and the web service would interact with the MySQL database.
In terms of how to write a web service, often, when people are writing their first web service, they'll use some simple technology like PHP. Do you know what options you have on your server? If PHP is an option, then you can check out Ray Wenderlich's How to Write a Simple PHP/MySQL Web Service. Then check out How to Write an iOS App that Uses a Web Service.
You should use SQLite instead of MySQL for iOS application. You are referring MacOSX application tutorial. try this http://www.raywenderlich.com/913/sqlite-tutorial-for-ios-making-our-app

HTML5 php websocket

I'm new to HTML 5, websocket. We are trying application like white board.Users who all are logged in that particular session can type their thoughts in white board div. It should display to all users who are logged in that session. So i tried to use Php Websocket. what all are the steps need to follow to run php Websocket on server side. Let me know further clarification.
Thanks,
Dhinesh.B
Find some PHP classes that implement the latest Websocket protocol RFC6455. This is an example implementation that I tested and that is working just fine: https://github.com/esromneb/phpwebsocket . Copy those files to your websocket subfolder (e.g. /websocket)
The steps are:
Run the server side PHP (e.g. php -q websocket.demo.php). Use a previously unused socket port.
Connect to the server using a client HTML with Javascript websocket code. In your Javascript code use the port that you specified for the server (e.g. localhost/websocket/client.html)