Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: PHP on APACHE not work

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

    Default PHP on APACHE not work

    Estou usando OpenSuse 13.1 and KDE

    I did the installation of Apache and PHP
    I created the file /srv/www/htdocs/index.html and /srv/www/htdocs/info.php

    When I use the address
    Code:
      http://localhost/index.html
    firefox shows the index.html page that was created before

    But if I put the address
    Code:
    http://localhost/info.php
    firefox asks if I want to download this file

    And nothing happens if I choose run with PHP instead do a donwnload.

    The same happens when I call a PHP program within a HTML.

    Please, what should I do so that PHP works on Apache?

  2. #2
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: PHP on APACHE not work

    Make sure the package: apache2-mod_php5 is installed.

    rpm -q apache2-mod_php5
    apache2-mod_php5-5.5.14-233.1.x86_64
    (Your version will be different, I use a repository version - don't worry about that)

    If you've installed that package and php5 is not working properly, try issuing: a2enmod php5

    Then restart Apache with: systemctl restart apache2
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  3. #3
    Join Date
    Feb 2014
    Location
    Enebyberg, Sweden
    Posts
    8

    Default Re: PHP on APACHE not work

    I have same issue. I can't see any solution here. Is there any howto for debugging? I have made clean install 13.1. Apache is working fine with html. mod_php5.so is loaded 7 times, one by root, others by wwwrun

  4. #4
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: PHP on APACHE not work

    Quote Originally Posted by seppolauri View Post
    Is there any howto for debugging?
    A few things you can look at:
    a2enmod -l

    Should list php5 in it.

    Run:
    curl -i http://your.server.ip/document.php

    Copy paste the output and wrap it in CODE tags ( # in the toolbar )

    If .php is being downloaded it would usually indicate that php5.conf is not being read properly and sethandler for .php files isn't thus being properly set as application/x-httpd-php, we can see this from the curl command.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  5. #5
    Join Date
    Feb 2014
    Location
    Enebyberg, Sweden
    Posts
    8

    Default Re: PHP on APACHE not work

    php5 is listed in a2enmod -l

    Result from curl
    Code:
                                                                                                                 
    HTTP/1.1 200 OK                                                                                                                                                                    
    Date: Mon, 02 Feb 2015 10:23:28 GMT                                                                                                                                                
    Server: Apache/2.4.6 (Linux/SUSE)                                                                                                                                                  
    Last-Modified: Sat, 31 Jan 2015 21:42:41 GMT                                                                                                                                       
    ETag: "13-50df999bf75ff"                                                                                                                                                           
    Accept-Ranges: bytes                                                                                                                                                               
    Content-Length: 19                                                                                                                                                                 
    Content-Type: application/x-php                                                                                                                                                    
                                                                                                                                                                                       
    <?php                                                                                                                                                                              
    phpinfo();

  6. #6
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: PHP on APACHE not work

    Please post the output of (code tag it): zypper se -si apache2

    Have you edited any of the configuration files by hand? For some reason php isn't being parsed by the module at all.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  7. #7
    Join Date
    Feb 2014
    Location
    Enebyberg, Sweden
    Posts
    8

    Default Re: PHP on APACHE not work

    zypper se -si apache2 output:
    Code:
    S | Name             | Type    | Version      | Arch   | Repository          
    --+------------------+---------+--------------+--------+---------------------
    i | apache2          | package | 2.4.6-6.41.1 | i586   | openSUSE-13.1-Update
    i | apache2-doc      | package | 2.4.6-6.41.1 | noarch | openSUSE-13.1-Update
    i | apache2-mod_php5 | package | 5.4.20-34.3  | i586   | openSUSE-13.1-Update
    i | apache2-prefork  | package | 2.4.6-6.41.1 | i586   | openSUSE-13.1-Update
    i | apache2-utils    | package | 2.4.6-6.41.1 | i586   | openSUSE-13.1-Update
    I have working 11.4 install on same box and I have manually updated/copied local changed config-files(parts) to 13.1 install. Something is missing, but I can't find what. Working 11.4 has apache2-2.2.17-80.1.i586, php5-5.3.17-387.2.i586 and apache2-mod_php5-5.3.17-387.2.i586

  8. #8
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: PHP on APACHE not work

    Quote Originally Posted by seppolauri View Post
    I have working 11.4 install on same box and I have manually updated/copied local changed config-files(parts) to 13.1 install.
    Yeah well that's it then - what files have you replaced exactly?

    You can't simply copy the configuration files from an earlier, Apache 2.2 no less, to an Apache 2.4 installation. There are several changes to the configuration files and their layout.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  9. #9
    Join Date
    Feb 2014
    Location
    Enebyberg, Sweden
    Posts
    8

    Default Re: PHP on APACHE not work

    Sorry my bad respons. I have only copied parts of config-files. Parts I think was needed for my needs. At the moment I am not sure what they are. I could easely copy all cofig files 11.4 to new 13.1 and see what happens, but as you tell that would make it worse. Other way to debug is to reinstall Apache and php to get original config and then make needed changes one by one until I find error. I have tried find differences with grep but there is too many lines to find the interesting ones for my purpose. As I told 11.4 work fine and 13.1 also except php. So my work is to find the difference causing the problem.

  10. #10
    Join Date
    Feb 2014
    Location
    Enebyberg, Sweden
    Posts
    8

    Default Re: PHP on APACHE not work

    Solved!

    Error caused by default-server.conf:
    Code:
      
      ServerName Intranet
    # YaST auto define section
    <IfDefine SSL>
     SSLEngine off
    </IfDefine>
    At some stage in my work I used YaST http-server module and it changed this file. I have several virtual IP-based hosts and all were affected by this. As I see this is bug in YaST and in apache2/php-module.

    I have reverted to rpm-original default-server.conf. No change is needed in it when using virtual hosts.

    Thank you Miuku for your support and engagement!

Page 1 of 2 12 LastLast

Posting Permissions

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