Display a html or php page
-
Hello! I try to display a page that i saved on the www folder in my omega. The idea is pick up my pc and at the http://192.168.3.1/mypage.html view my page. Is it possible? How to do it?
-
Howdy @Enrico-Rossi ,
Yep totally do-able
The Omega runs uhttpd which is a mini webserver and is what you've been using the view the console with.
If you want to view this page on other computers in your network, you'll want to make sure that you "Wi-Fi Network Setup" is setup to be connected to a wifi network so the Omega is reachable from other points in your network.
To find out the IP address, type this on the command line and press enter:
/sbin/ifconfig -a
It'll be "wlan0" and something like 192.168.0.10
To create a page, from the command line run this:
cd /www/
vi mypage.htmlEnter in your code and then save
Then go to http://192.168.3.1/mypage.html or... if you find out the IP address of your device, you can then use that instead.
You can use the text editor in the Omega console, but the created file won't have enough permissions to be viewed, if that is what you've done run this command in the terminal:
chmod 755 /www/myfile.html
And see if that resolves it.
Anyway, hope that helps!
Matt
-
@Matt-Ogborne THANK YOU VERY MUCH! It works the html file! Now my problem is to view a php.
I have to put in in the www folder and give it the permission like
chmod 755 /www/myfile.php ??because the command in the console work but when I try to display the page it say:
Unable to launch the requested CGI program:
/usr/bin/php-cgi: Permission denied
-
I have doubts that the uhttpd comes out of the box with php?!
Btw there is a tutorial how to install a LAMP Stack on the Omega. But note that you will use a lot of memory.
https://wiki.onion.io/Tutorials/How-To-Install-LAMP-Stack-on-the-Omega
-
There's also new tutorials about PHP:
https://wiki.onion.io/Tutorials/PHP-GPIO-Example
https://wiki.onion.io/Tutorials/PHP-PushBullet-Example
-
Howdy,
Yep that's right, you'll need to add the php mod files for php to work, as Lazar mentioned, see the tutorials I popped together on this.
Matt
PS. My 3rd Omega arrived a few days ago. I'll put together a couple of "Matt proof" tutorials for everyone to get started and some advanced ones too.
-
Thank you very much at all! I follow the instruction in:
https://wiki.onion.io/Tutorials/PHP-GPIO-Examplebut when I try to display my file in the browser it download it and no display! Why?
-
what is the URL of your file?
what are the first lines of your file?
-
@Frederic-Baumann http://192.168.3.1/php/index.php
and this is the file:
<?php
echo "hello world, I'm PHP running on my Onion Omega!";
-
I try with:
https://wiki.onion.io/Tutorials/PHP-PushBullet-Exampleand same problem... the php file download and no display in the browser
-
Looks fine.
Imho, their should be an issue in your /etc/config/uhttpd file.
Did you double-check the line : list interpreter ".php=/usr/bin/php-cgi"
?
-
And of course did you restart uhttpd?
-
ok resolved thank you very much!
-
I am facing the same issue.
followed the steps as suggested, but still the index.php is getting downloaded...
check uhttpd config and restarted the uhttpd.
please help
-
facing the same problem as well
is there any fix?
-
Actually. I would more recommend using lighttpd than Apache or uhttpd. I don't know why but I feel that lighttpd is more faster, stable and uses less resources that anything.