Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vborra
Visitor

Using Roku as a server(run a php file on roku)

I am currently trying to find how to run a PHP file( Make roku a server) and I cannot find how to do this anywhere. I already have the PHP file ready to go I just need to find how to run it. Would I have to use BrightScript to do this?? Thanks for any help whatsoever.
0 Kudos
4 REPLIES 4
destruk
Streaming Star

Re: Using Roku as a server(run a php file on roku)

Brightscript doesn't understand PHP. You can use the 3.0 SDK to run the roku as an HTML server, but PHP isn't supported.
0 Kudos
vborra
Visitor

Re: Using Roku as a server(run a php file on roku)

I am a beginner so where do I get the 3.0 SDK???? or Is it possible to run ruby code???
0 Kudos
RokuJoel
Binge Watcher

Re: Using Roku as a server(run a php file on roku)

The short answer is No. You can write a Brightscript app that has some equivalent functionality that runs on the Roku, but interpreting or compiling PHP or Ruby is beyond the scope of what is practical in Brightscript (not saying it is impossible, but, it would probably be impossibly slow).

You can get the SDK from the developer page in your Roku account, once you have signed up for the developer program.

- Joel
0 Kudos
gonzotek
Visitor

Re: Using Roku as a server(run a php file on roku)

"RokuJoel" wrote:
The short answer is No. You can write a Brightscript app that has some equivalent functionality that runs on the Roku, but interpreting or compiling PHP or Ruby is beyond the scope of what is practical in Brightscript (not saying it is impossible, but, it would probably be impossibly slow).
I've spent some time with the 3.0 web server example and agree that, depending on the specific application, simple ruby/php/etc. scripts could be ported to Brightscript, but directly interpretting and running them as-is is simply not a workable approach.

The web server example code is available for viewing online here:
http://sourceforge.net/p/rokusdkexample ... er/source/

I would say it's non-trivial to get started, as you really have to read through the server code and understand the program flow. Expect to spend a lot of time in the debugger, peppering the code with print statements. The files of particular interest are: main.brs, server.brs, request.brs, connection.brs, and especially reply.brs. There is a function in reply.brs called reply_process_get, where you can hook into the GET request (e.g. GET http://rokuWebServerAddress/somefile.ext?param=option) and diverge the flow of the code depending on the request and what you want to do with it. From there you can construct your own dynamic response and port the functionality of the php or ruby script to Brightscript. Keep in mind that only one Roku channel runs at a time, so your script will only be available when the web server channel is running.
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.