YouAintTheHost
Posts: 2
Joined: Wed May 28, 2014 1:19 pm

PHP application with keyboard input

Wed May 28, 2014 1:21 pm

I wrote a small PHP application that accepts input from a USB keyboard. I want to run this application as soon as the PI boots up. I have put the application in inittab... however, it appears as though the screen that has control of the keyboard is the login screen.

Is it possible to not login, and have my application accept keyboard input while the system is NOT logged in?

atomic3
Posts: 99
Joined: Thu Jan 17, 2013 4:31 pm

Re: PHP application with keyboard input

Wed May 28, 2014 3:21 pm

PHP is a web server language and is executed when you visit that certain PHP page.

Or am I missing something?

php files should reside in /var/www or wherever your server is configured. The files are accessed through your browser.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: PHP application with keyboard input

Wed May 28, 2014 3:29 pm

You can use PHP from the command line , just like perl/python/ruby/whatever ..

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

YouAintTheHost
Posts: 2
Joined: Wed May 28, 2014 1:19 pm

Re: PHP application with keyboard input

Wed May 28, 2014 5:08 pm

Indeed... yes, I am using PHP as a command line tool. It also spawns off a couple different python scripts in order for the system to do what I want.

However, the important piece to me as it stands is having the application start up through inittab at the start, and have complete control over the keyboard input (I am using the stdin to retrieve the input from the keyboard). As i mentioned though, the login screen seems to have control of the keyboard when the system starts up. I want my PHP script to have control of stdin instead.

Is it a problem of timing (since inittab starts my process first, the login screen starts after that, and has control?).

riklaunim
Posts: 265
Joined: Tue Apr 22, 2014 7:34 pm

Re: PHP application with keyboard input

Wed May 28, 2014 5:31 pm

Maybe you should take over specific USB device (the keyboard) and not stdin? pyusb can do that.

Return to “Beginners”