Webpage with PHP not working

Moderator: leecollings

Post Reply
User avatar
Marq
Posts: 17
Joined: Sunday 26 April 2015 12:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Webpage with PHP not working

Post by Marq »

'
Hi there,

I am trying to setup PHP on a Raspberry Pi.

What does work: PHP is installed (' sudo apt-get install php5 '). This code is entered in ' ~/domoticz/scripts/firstexample.php '

Code: Select all

#!/usr/bin/php
<?php
  phpinfo();
?>
then saved, made executable (' chmod +x firstexample.php ')
executing the script from a CLI (eg. Putty) with (' ./firstexample.php ') gives the expected/desired result

What does not work:
Entering this code in a file ' ~/domoticz/www/secondexample.php ' :

Code: Select all

<?php
  phpinfo();
?>
and then calling this webpage from a web browser: http://192.168.1.1:8080/secondexample.php
just results in an echo of the entered code (so not executing the code, and (thus) not displaying the outcome)

I expect that something is missing in the internal webserver.
Can someone give a (link to a) solution ?

Thanks !
Mark
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Webpage with PHP not working

Post by bizziebis »

The built-in webserver of Domoticz is a HTML one. It doesn't handle PHP. If you want PHP, you have to run your own PHP webserver on a different port.
User avatar
Marq
Posts: 17
Joined: Sunday 26 April 2015 12:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Webpage with PHP not working

Post by Marq »

Thanks for the reply.

Any suggestion how to build a webserver which runs php ?

Thanks, Mark
User avatar
chimit
Posts: 259
Joined: Saturday 18 April 2015 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version: master
Location: Rotterdam, the Netherlands
Contact:

Re: Webpage with PHP not working

Post by chimit »

If you have installed php, then probably you also have apache installed.
Put your php scripts in /var/www.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Webpage with PHP not working

Post by Egregius »

Apache2 and nginx runs fine on RPi.
User avatar
Marq
Posts: 17
Joined: Sunday 26 April 2015 12:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Webpage with PHP not working

Post by Marq »

chimit wrote:If you have installed php, then probably you also have apache installed.
Put your php scripts in /var/www.
Indeed, this is true. It works. Thanks !
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests