Results 1 to 7 of 7

Thread: php does not work

  1. #1

    Default php does not work

    Some 10 years ago I have been programming with php within web pages, and there was never any problem. Now, trying it again, I do encounter a problem. Php does not work. The simple function


    <?php
    echo “Hallo World”;
    ?>


    Does not work – nothing appears in a browser. In the blueFish editor, the first line appears underlined red, an indication that the statement is not recognized by Appache.


    The following packages are installed and activated:
    apache2 version 2.4.23-31-1
    apache2-mod_php7 version 7.0.7-52.1
    php7 version 7.0.7-52.1
    OS is SUSElinux version 42.3
    all software has been downloaded from the official openSUSE repositories.


    Is there anything else missing, or do I have to do something about the configuration settings?
    I did not find any clue on the intelligent web pages.


    Any help would be highly appreciated.
    Thank you.

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,822
    Blog Entries
    15

    Default Re: php does not work

    Quote Originally Posted by nicari View Post
    Some 10 years ago I have been programming with php within web pages, and there was never any problem. Now, trying it again, I do encounter a problem. Php does not work. The simple function


    <?php
    echo “Hallo World”;
    ?>


    Does not work – nothing appears in a browser. In the blueFish editor, the first line appears underlined red, an indication that the statement is not recognized by Appache.


    The following packages are installed and activated:
    apache2 version 2.4.23-31-1
    apache2-mod_php7 version 7.0.7-52.1
    php7 version 7.0.7-52.1
    OS is SUSElinux version 42.3
    all software has been downloaded from the official openSUSE repositories.


    Is there anything else missing, or do I have to do something about the configuration settings?
    I did not find any clue on the intelligent web pages.


    Any help would be highly appreciated.
    Thank you.
    Hi
    Is the php7 module enabled and apache restarted?

    Code:
    a2enmod -l
    a2enmod php7
    systemctl restart apache2
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Default Re: php does not work

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Is the php7 module enabled and apache restarted?

    Code:
    a2enmod -l
    a2enmod php7
    systemctl restart apache2

    Hi Malcolm


    Thank you for your speedy answer. I followed your advise, and the following is the output from the 3 commands.


    linux-egbert:/home/egbert # a2enmod -l
    actions alias auth_basic authn_file authz_host authz_groupfile authz_core authz_user autoindex cgi dir
    env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir reqtimeout authn_cor
    e php7
    linux-egbert:/home/egbert # a2enmod php7
    "php7" already present
    linux-egbert:/home/egbert # systemctl restart apache2
    linux-egbert:/home/egbert #

    Still, there is no output from the php7 function in the browser.

    I also restarted the computer, to no avail.


    Anything else I can do to fix this?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,130

    Default Re: php does not work

    Quote Originally Posted by nicari View Post

    Still, there is no output from the php7 function in the browser.
    That is strange, because when you try to load a page that is in fact a PHP script from Apache in a browser and Apache, for some reason, does not run the PHP script, the browser should show the text of the script and not a blank page.
    Henk van Velden

  5. #5
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,054

    Default Re: php does not work

    On Mon, 21 Jan 2019 03:56:04 +0000, nicari wrote:

    > Some 10 years ago I have been programming with php within web pages, and
    > there was never any problem. Now, trying it again, I do encounter a
    > problem. Php does not work. The simple function
    >
    >
    > <?php echo “Hallo World”;
    > ?>
    >
    >
    > Does not work – nothing appears in a browser. In the blueFish editor,
    > the first line appears underlined red, an indication that the statement
    > is not recognized by Appache.
    >
    >
    > The following packages are installed and activated:
    > apache2 version 2.4.23-31-1 apache2-mod_php7 version

    7.0.7-52.1 php7
    > version 7.0.7-52.1 OS is SUSElinux version 42.3 all software has been
    > downloaded from the official openSUSE repositories.
    >
    >
    > Is there anything else missing, or do I have to do something about the
    > configuration settings?
    > I did not find any clue on the intelligent web pages.
    >
    >
    > Any help would be highly appreciated.
    > Thank you.


    What do you see if you view the page source when you browse to it?

    I ask because the text you're displaying isn't HTML, and it may be that
    the browser isn't rendering it because it's raw text (though it
    *shouldn't* do that, it may well be)
    ..



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  6. #6

    Default Re: php does not work

    @nicari:
    Quote Originally Posted by nicari View Post
    Some 10 years ago I have been programming with php within web pages, and there was never any problem. Now, trying it again, I do encounter a problem. Php does not work. The simple function


    <?php
    echo “Hallo World”;
    ?>


    Does not work – nothing appears in a browser. In the blueFish editor, the first line appears underlined red, an indication that the statement is not recognized by Appache.
    I noticed the funny quotes in your snippet. After quickly creating a php-file and copying/pasting your snippet, I got an empty page in my browser as well.

    This was in my /var/log/apache/error_log:

    [Mon Jan 21 22:49:54.871080 2019] [php7:emerg] [pid 6196] [client 127.0.0.1:54472] PHP Parse error: syntax error, unexpected 'World\xe2\x80\x9d' (T_STRING), expecting ',' or ';' in /home/leen/public_html/hallo.php on line 2
    Did you get something similar in your error_log?

    Does your php-file load correctly after you replace both the “ (U+201C) and the ” (U+201D) with " (U+0022)? (Mine did).

    Kind regards,

    Leen Meyer

  7. #7

    Default Re: php does not work

    Quote Originally Posted by nicari View Post

    Hi Malcolm


    Thank you for your speedy answer. I followed your advise, and the following is the output from the 3 commands.


    linux-egbert:/home/egbert # a2enmod -l
    actions alias auth_basic authn_file authz_host authz_groupfile authz_core authz_user autoindex cgi dir
    env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir reqtimeout authn_cor
    e php7
    linux-egbert:/home/egbert # a2enmod php7
    "php7" already present
    linux-egbert:/home/egbert # systemctl restart apache2
    linux-egbert:/home/egbert #

    Still, there is no output from the php7 function in the browser.

    I also restarted the computer, to no avail.


    Anything else I can do to fix this?

    Thanks very much for your help. php works now.
    The last error was my own fault, I simply forgot to rename the file from .html to .php.
    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •