PHP doesn't work

Discussion in 'UDOO NEO' started by Vinz87, Dec 18, 2016.

  1. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    Hi, I followed this tutorial https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
    to enable PHP to my already working webserver on Neo.
    Unfortunately, even after installing PHP, if I open from the browser a PHP webpage, I get results only from the HTML part, as if PHP was not running.

    In OS X I recall that PHP has to be enabled from the Apache .conf files; is there something similar I have to do here?
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  3. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    the web configuration panel is listening on port 8080.
    On port 80 I set the webserver, which is working properly, but without PHP support.
     
  4. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Can you post a copy of the index.php file you are looking at and the output it is giving?
     
  6. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    <?
    phpinfo();
    ?>
    test_html

    This is a file called phpinfo.php, in /var/www/html. When opened with a browser it will output only "test_html".
     
  7. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    To verify that the php module is loaded, type:

    a2query -m php5

    if not enabled, then load with:

    sudo a2enmod php5

    and restart apache:

    sudo service apache2 restart
     
  8. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    it says it's already enabled:
    udooer@udooneo:~$ a2query -m php5
    php5 (enabled by maintainer script)
     
  9. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    It should be
    <?php phpinfo(); ?>
     
  10. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    That was the problem, thanks.

    Anyway, on my computer (OS X El Capitan, PHP 5.5.38) it doesn't make any difference, php code enclosed by <? and ?> will be correctly interpreted.
    Is it a matter of PHP version?
     
  11. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580

Share This Page