Results 1 to 8 of 8

Thread: Firefox don't execut PHP

  1. #1
    Join Date
    Aug 2013
    Location
    Jundiai, São Paulo, Brazil
    Posts
    464

    Default Firefox don't execut PHP

    I'm trying to use PHP 7
    When I use the address localhost/index.php in FIREFOX the index.php file is not being executed.
    How do I solve this problem?

    Thanks in advance

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,854

    Default Re: Firefox don't execut PHP

    This has nothing to do with Firefox. HTTP browsers do not execute PHP files. The server program does (or at least should do it).

    You do not tell what server program you use, I assume Apache. What did you do to let Apache execute PHP files?
    Henk van Velden

  3. #3
    Join Date
    Aug 2013
    Location
    Jundiai, São Paulo, Brazil
    Posts
    464

    Default Re: Firefox don't execut PHP

    Quote Originally Posted by hcvv View Post
    This has nothing to do with Firefox. HTTP browsers do not execute PHP files. The server program does (or at least should do it).

    You do not tell what server program you use, I assume Apache. What did you do to let Apache execute PHP files?
    I execute the command bellow to let Apache run PHP files

    service apache2 start
    After this command, the address localhost/index.html works.
    But localhost/index.php does not work

    I have a machine openSUSE 13.2 and his Firefox opens the localhost/index.php address
    I checked the settings of /etc/apache2, they are absolutely identical on both machines.

  4. #4
    Join Date
    Aug 2013
    Location
    Jundiai, São Paulo, Brazil
    Posts
    464

    Default Re: Firefox don't execut PHP

    In addition
    The code below shows only text html
    The text in php not appear only appear the html code
    Code:
    <html>
    Bellow the echo  php
    <?php
    echo "xxxxxxxxxxxxxxxx";
    phpinfo();  
    ?>
    <br>Above the echo  php
    </html>

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,854

    Default Re: Firefox don't execut PHP

    Apache does not handle PHP by default.

    I run openSUSE 31.1, Apache and PHP5.
    In my default-server.conf I have
    Code:
    Include /etc/apache2/conf.d/*.conf
    and in /etc/apache2/conf.d I have
    Code:
    boven:/etc/apache2 # ls -l conf.d
    total 16
    -rw-r--r-- 1 root root 646 Oct  9  2015 manual.conf
    -rw-r--r-- 1 root root 344 Oct  9  2015 mod_cgid-timeout.conf
    -rw-r--r-- 1 root root 694 Jun  1  2015 mod_perl.conf
    -rw-r--r-- 1 root root 354 Sep 17  2015 php5.conf
    boven:/etc/apache2 #
    Thus that php5.conf is added to the Apache configuration. You can of course include it directly (not using the wild card construct that includes more then one file) and of course you need a corresponding PHP7 file (which may already be there when you installed PHP7 from an openSUSE repo).

    In any case you have to do something similar to tell Apache how to handle files with a .php suffix.
    Henk van Velden

  6. #6
    Join Date
    Aug 2013
    Location
    Jundiai, São Paulo, Brazil
    Posts
    464

    Default Re: Firefox don't execut PHP

    Quote Originally Posted by hcvv View Post
    Apache does not handle PHP by default.

    I run openSUSE 31.1, Apache and PHP5.
    In my default-server.conf I have
    Code:
    Include /etc/apache2/conf.d/*.conf
    and in /etc/apache2/conf.d I have
    Code:
    boven:/etc/apache2 # ls -l conf.d
    total 16
    -rw-r--r-- 1 root root 646 Oct  9  2015 manual.conf
    -rw-r--r-- 1 root root 344 Oct  9  2015 mod_cgid-timeout.conf
    -rw-r--r-- 1 root root 694 Jun  1  2015 mod_perl.conf
    -rw-r--r-- 1 root root 354 Sep 17  2015 php5.conf
    boven:/etc/apache2 #
    Thus that php5.conf is added to the Apache configuration. You can of course include it directly (not using the wild card construct that includes more then one file) and of course you need a corresponding PHP7 file (which may already be there when you installed PHP7 from an openSUSE repo).

    In any case you have to do something similar to tell Apache how to handle files with a .php suffix.
    I did your instructions but not work.

    I have a machine with opensuse 13.2 and, Firefox is running PHP files

    For lack of options, I copied the /apache2 folder from the 13.2 machine to machine LEAP
    I restarted all
    But the problem remains
    When Firefox opens the address localhost/index.html, it shows only the html content, nothing that is in PHP appears

    No one else has this problem with PHP7 and LEAP????

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,854

    Default Re: Firefox don't execut PHP

    Quote Originally Posted by sergelli View Post
    I did your instructions but not work.
    I did not give instructions. I showed you what I have in another version to communicate to you where you should look. Doing exactly what I showed will not work. E.g. how do you think that adding a php5.conf file (of which I btw did not give you the contents) can make a php7 environment working?

    And I repeat: It is NOT Fiirefox that is doing things (or not). It is Apache.
    Henk van Velden

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,923
    Blog Entries
    2

    Default Re: Firefox don't execut PHP

    First, it should be noted that PHP code is not much different than many other scripting code that is often used as webserver code, it can also be run without a webserver although not seen that way often. The following reference is for those who are interested in this rare implementation
    http://www.php.net/manual/en/feature...troduction.php

    Most people though will run PHP as server-side code within webpages served by a webserver. Assuming this Forum thread is about this common implementation...

    The first step that should have been asked was whether PHP was properly installed into Apache.
    Was Apache and PHP set up using the LAMP pattern? Installed separately using YAST or zypper? Some other way?

    From here on, I'm assuming a default openSUSE Apache installation.

    The next step (which can still be executed) is to run a PHP test page.
    To do this,
    Rename/move your existing index.html page to disable it. Run the following in a root console. An existing default index.html may display instead of a php page
    Code:
    mv /srv/www/htdocs/index.html /srv/www/htdocs/index.html.bak
    Now create a new index.php file in that location with the following content
    Code:
    <html>
     <head>
      <title>PHP Test</title>
     </head>
     <body>
    <?php echo '<p>Hello World</p>'; ?>
     </body>
    </html>
    Now, start or restart your Apache webserver. The following does this
    Code:
    systemctl restart apache2.service
    Now you can open a web browser to "http://localhost" and see if "Hello World" displays or you see an error.
    If nothing displays, you can explicitly request the page "http://localhost/index.php" if that file name isn't in the list of default pages.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

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