PHP5 on the Arduino YUN

Would like to run PHP on my YUN, I have run the following on the YUN:

opkg update opkg php5

Using WinXP and PuTTY connecting to root, I expect to type PHP and see the CLI version (like I can type python2.7). I have tried to find - name "php", expecting to find something like php5.4, no luck.

If I opkg install php5, I get "Package php5 (5.4.17-1) installed in root is up to date."

What am I missing?

Thanks...

Argh, I'm sorry: it seems like my previous instructions were wrong. You need to install php5-cli or php5-cgi: those will install an actual executable

hello so i had the same problem and i did: opkg update opkg install php5-cgi

i restarted the yun and when i type php i dont get the php cli. Also putting a .php file into the www dir, does not open, it asks to save it. What am i doing wrong?

if i try to reinstall i get: Package php5-cgi (5.4.17-1) installed in root is up to date.

thanks in advance

Here is a link that might help:

http://wiki.openwrt.org/doc/howto/lamp?s%5B%5D=mysql#installing.and.configuring.php

@takissd when you install php5-cgi you install the cgi version of php (program is called php-cgi). If you need the cli version you need to install php5-cli

hello there that did not work either... i have installed both cli and cgi.

Also the link that @EdwardE send, i think i have everything it proposes there but still i cannot run php files...

Any detailed step by step procedure ? Thanks again for your time!

Check out this link, make sure you 'uncomment the extension interpreter line for PHP in the main section of the uHTTPd config file':

http://forum.arduino.cc/index.php?topic=187386.0

Thanks for the reply, i am not quite sure where the uHTTPd config file is located,could you please let me know?

@takissd
It’s /etc/config/uhttpd
Can you paste the sequence of commands you run to test the php is not working on the command line?

hello thanks for the reply.
Is there an easy way to edit this file?
I usually connected with Filezilla download it on my pc edit it and then upload again, but now i cannot do this with the yun, now idea why.
How do you guys edit the file?
Once i will edit it i will post what happened and the steps i took.
Thank you again

I haven’t worked with the linino distro yet but I would assume that vi, nano or emacs are available. Try -

vi

move the cursor to where you want to edit
i to start editing
when done press esc then :wq then enter(: goes to command mode, wq stands for write and quit)
If you need to move the cursor around press esc first then i to insert

nano is much simpler if it is available, try opkg install nano if not

vi cheatsheet - http://www.lagmonster.org/docs/vi.html

@liomry: thank you very much vi worked fine! I forgot about that :slight_smile:

@Federico: Found the file and edit it, my steps where:

opkg update
opkg install php-cgi
opkg install php-cli

uncomment line on: /etc/config/uhttpd

Created a file callled hello.php that contains:


Hello World in PHP <?php // Hello world in PHP print("Hello World"); ?> ----------------------

Uploaded the file on the sd card.
(BTW tested the file on my apache server at another machine it works fine)

I try to see the file from my browser as a hello.php, asks me to save the file (firefox)
renaming the file to hello.html i cannot see Hello World.

Any ideas?
Thanks again!

I think you just need to restart uhttpd. You've changed its configuration file but it's still running with the old configuration. Type

/etc/init.d/uhttpd restart

Given the hour of your last post, you have probably powered your yun off. When you'll turn it on again, your php file will be running fine

you are correct, i actually had it up and running till now but i restarted anyway :slight_smile: It works now, thanks for your help!

I have some troubles installing php. i follow the steps from takissd

Below are the errors I get Any ideas?

root@Arduino:~# opkg update

Downloading http://download.linino.org/dogstick/all-in-one/latest/packages//Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker.
Downloading http://download.linino.org/dogstick/all-in-one/latest/packages//Packages.sig.
Signature check passed.

root@Arduino:~# opkg install php-cgi
Unknown package 'php-cgi'.
Collected errors:
 * opkg_install_cmd: Cannot install package php-cgi.

root@Arduino:~# cd /usr/bin
root@Arduino:/usr/bin# opkg install php-cgi
Unknown package 'php-cgi'.
Collected errors:
 * opkg_install_cmd: Cannot install package php-cgi.
root@Arduino:/usr/bin#

It's php5-cgi and so on See this: http://playground.arduino.cc/Hardware/Yun#installing_php

Thanks Federico, Yes I see it now now I have PHP up and running

Erni:
I have some troubles installing php.
i follow the steps from takissd

Below are the errors I get
Any ideas?

root@Arduino:~# opkg update

Downloading http://download.linino.org/dogstick/all-in-one/latest/packages//Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker.
Downloading http://download.linino.org/dogstick/all-in-one/latest/packages//Packages.sig.
Signature check passed.

root@Arduino:~# opkg install php-cgi
Unknown package ‘php-cgi’.
Collected errors:

  • opkg_install_cmd: Cannot install package php-cgi.

root@Arduino:~# cd /usr/bin
root@Arduino:/usr/bin# opkg install php-cgi
Unknown package ‘php-cgi’.
Collected errors:

  • opkg_install_cmd: Cannot install package php-cgi.
    root@Arduino:/usr/bin#

try this: opkg install php5-cgi

try this: opkg install php5-cgi

hope this help

Yes... The right package is php5-cgi not php-cgi