Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: PHP5 modules not loading in Apache

  1. #1
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default PHP5 modules not loading in Apache

    Hi,

    I installed Apache2, apache2-mod_php5 and php5. Apache doesn't seem to be loading the php modules though. When I do httpd2 -M I get:

    Code:
    Loaded Modules:
     core_module (static)
     mpm_prefork_module (static)
     http_module (static)
     so_module (static)
     actions_module (shared)
     alias_module (shared)
     auth_basic_module (shared)
     authn_file_module (shared)
     authz_host_module (shared)
     authz_groupfile_module (shared)
     authz_default_module (shared)
     authz_user_module (shared)
     authn_dbm_module (shared)
     autoindex_module (shared)
     cgi_module (shared)
     dir_module (shared)
     env_module (shared)
     expires_module (shared)
     include_module (shared)
     log_config_module (shared)
     mime_module (shared)
     negotiation_module (shared)
     setenvif_module (shared)
     ssl_module (shared)
     suexec_module (shared)
     userdir_module (shared)
    php is not in the list for some reason. httpd.conf and php5.conf in next post

  2. #2
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default Re: PHP5 modules not loading in Apache

    My php5.conf is this:

    Code:
    <IfModule mod_php5.c>
            LoadModule php5_module modules/libphp5.so
            AddType application/x-httpd-php .php .htm .html
            AddType application/x-httpd-php-source .phps
            DirectoryIndex index.php index.htm index.html
            AddHandler application/x-httpd-php .php4
            AddHandler application/x-httpd-php .php5
            AddHandler application/x-httpd-php .php
            AddHandler application/x-httpd-php-source .php4s
            AddHandler application/x-httpd-php-source .php5s
            AddHandler application/x-httpd-php-source .phps
            DirectoryIndex index.php4
            DirectoryIndex index.php5
            DirectoryIndex index.php
    </IfModule>
    and httpd.conf

    Code:
    #
    # /etc/apache2/httpd.conf 
    #
    # This is the main Apache server configuration file.  It contains the
    # configuration directives that give the server its instructions.
    # See <URL:http://httpd.apache.org/docs-2.2/> for detailed information about
    # the directives.
    
    # Based upon the default apache configuration file that ships with apache,
    # which is based upon the NCSA server configuration files originally by Rob
    # McCool. This file was knocked together by Peter Poeml <poeml+apache@suse.de>.
    
    # If possible, avoid changes to this file. It does mainly contain Include
    # statements and global settings that can/should be overridden in the
    # configuration of your virtual hosts.
    
    # Quickstart guide:
    # http://www.opensuse.org/Apache_Howto_Quickstart
    
    
    # Overview of include files, chronologically:
    #
    # httpd.conf
    #  | 
    #  |-- uid.conf  . . . . . . . . . . . . . .  UserID/GroupID to run under
    #  |-- server-tuning.conf  . . . . . . . . .  sizing of the server (how many processes to start, ...)
    #  |-- sysconfig.d/loadmodule.conf . . . . .[*] load these modules
    #  |-- listen.conf . . . . . . . . . . . . .  IP adresses / ports to listen on
    #  |-- mod_log_config.conf . . . . . . . . .  define logging formats
    #  |-- sysconfig.d/global.conf . . . . . . .[*] server-wide general settings
    #  |-- mod_status.conf . . . . . . . . . . .  restrict access to mod_status (server monitoring)
    #  |-- mod_info.conf . . . . . . . . . . . .  restrict access to mod_info
    #  |-- mod_usertrack.conf  . . . . . . . . .  defaults for cookie-based user tracking
    #  |-- mod_autoindex-defaults.conf . . . . .  defaults for displaying of server-generated directory listings
    #  |-- mod_mime-defaults.conf  . . . . . . .  defaults for mod_mime configuration
    #  |-- errors.conf . . . . . . . . . . . . .  customize error responses
    #  |-- ssl-global.conf . . . . . . . . . . .  SSL conf that applies to default server _and all_ virtual hosts
    #  |
    #  |-- default-server.conf . . . . . . . . .  set up the default server that replies to non-virtual-host requests
    #  |    |--mod_userdir.conf  . . . . . . . .  enable UserDir (if mod_userdir is loaded)
    #  |    `--conf.d/apache2-manual?conf  . . .  add the docs ('?' = if installed)
    #  |
    #  |-- sysconfig.d/include.conf  . . . . . .[*] your include files 
    #  |                                             (for each file to be included here, put its name 
    #  |                                              into APACHE_INCLUDE_* in /etc/sysconfig/apache2)
    #  |
    #  `-- vhosts.d/ . . . . . . . . . . . . . .  for each virtual host, place one file here
    #       `-- *.conf . . . . . . . . . . . . .     (*.conf is automatically included)
    #
    #
    # Files marked[*] are created from sysconfig upon server restart: instead of
    # these files, you edit /etc/sysconfig/apache2
    
    
    
    #  Filesystem layout:
    #
    # /etc/apache2/
    #  |-- charset.conv  . . . . . . . . . . . .  for mod_auth_ldap
    #  |-- conf.d/
    #  |   |-- apache2-manual.conf . . . . . . .  conf that comes with apache2-doc
    #  |   |-- mod_php4.conf . . . . . . . . . .  (example) conf that comes with apache2-mod_php4
    #  |   `-- ... . . . . . . . . . . . . . . .  other configuration added by packages
    #  |-- default-server.conf
    #  |-- errors.conf
    #  |-- httpd.conf  . . . . . . . . . . . . .  top level configuration file
    #  |-- listen.conf
    #  |-- magic
    #  |-- mime.types -> ../mime.types
    #  |-- mod_autoindex-defaults.conf
    #  |-- mod_info.conf
    #  |-- mod_log_config.conf
    #  |-- mod_mime-defaults.conf
    #  |-- mod_perl-startup.pl
    #  |-- mod_status.conf
    #  |-- mod_userdir.conf
    #  |-- mod_usertrack.conf
    #  |-- server-tuning.conf
    #  |-- ssl-global.conf
    #  |-- ssl.crl/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Revocation Lists (CRL)
    #  |-- ssl.crt/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificates
    #  |-- ssl.csr/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Signing Requests
    #  |-- ssl.key/  . . . . . . . . . . . . . .  PEM-encoded RSA Private Keys
    #  |-- ssl.prm/  . . . . . . . . . . . . . .  public DSA Parameter Files
    #  |-- sysconfig.d/  . . . . . . . . . . . .  files that are created from /etc/sysconfig/apache2
    #  |   |-- global.conf
    #  |   |-- include.conf
    #  |   `-- loadmodule.conf
    #  |-- uid.conf
    #  `-- vhosts.d/ . . . . . . . . . . . . . .  put your virtual host configuration (*.conf) here
    #      |-- vhost-ssl.template
    #      `-- vhost.template
    
    
    
    ### Global Environment ######################################################
    #
    # The directives in this section affect the overall operation of Apache,
    # such as the number of concurrent requests.
    Include /etc/apache2/conf.d/php5.conf
    
    # run under this user/group id
    Include /etc/apache2/uid.conf
    
    # - how many server processes to start (server pool regulation)
    # - usage of KeepAlive
    Include /etc/apache2/server-tuning.conf
    
    # ErrorLog: The location of the error log file.
    # If you do not specify an ErrorLog directive within a <VirtualHost>
    # container, error messages relating to that virtual host will be
    # logged here.  If you *do* define an error logfile for a <VirtualHost>
    # container, that host's errors will be logged there and not here.
    ErrorLog /var/log/apache2/error_log
    
    # generated from APACHE_MODULES in /etc/sysconfig/apache2
    Include /etc/apache2/sysconfig.d/loadmodule.conf
    
    # IP addresses / ports to listen on
    Include /etc/apache2/listen.conf
    
    # predefined logging formats
    Include /etc/apache2/mod_log_config.conf
    
    # generated from global settings in /etc/sysconfig/apache2
    Include /etc/apache2/sysconfig.d/global.conf
    
    # optional mod_status, mod_info
    Include /etc/apache2/mod_status.conf
    Include /etc/apache2/mod_info.conf
    
    # optional cookie-based user tracking
    # read the documentation before using it!!
    Include /etc/apache2/mod_usertrack.conf
    
    # configuration of server-generated directory listings
    Include /etc/apache2/mod_autoindex-defaults.conf
    
    # associate MIME types with filename extensions
    TypesConfig /etc/apache2/mime.types
    DefaultType text/plain
    Include /etc/apache2/mod_mime-defaults.conf
    
    # set up (customizable) error responses
    Include /etc/apache2/errors.conf
    
    # global (server-wide) SSL configuration, that is not specific to 
    # any virtual host
    Include /etc/apache2/ssl-global.conf
    
    # forbid access to the entire filesystem by default
    <Directory />
        Options None
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>
    
    # user directives
    
    # List of resources to look for when the client requests a directory
    DirectoryIndex index.html index.html.var index.php
    
    AddType text/html php
    
    # end user directives 
    
    # use .htaccess files for overriding,
    #AccessFileName .htaccess
    # and never show them
    #<Files ~ "^\.ht">
    #    Order allow,deny
    #    Deny from all
    #</Files>
    
    ### 'Main' server configuration #############################################
    #
    # The directives in this section set up the values used by the 'main'
    # server, which responds to any requests that aren't handled by a
    # <VirtualHost> definition.  These values also provide defaults for
    # any <VirtualHost> containers you may define later in the file.
    #
    # All of these directives may appear inside <VirtualHost> containers,
    # in which case these default settings will be overridden for the
    # virtual host being defined.
    #
    Include /etc/apache2/default-server.conf
    
    
    # Another way to include your own files
    #
    # The file below is generated from /etc/sysconfig/apache2,
    # include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
    # APACHE_CONF_INCLUDE_DIRS
    Include /etc/apache2/sysconfig.d/include.conf
    
    
    ### Virtual server configuration ############################################
    #
    # VirtualHost: If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at
    # <URL:http://httpd.apache.org/docs-2.2/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.
    #
    Include /etc/apache2/vhosts.d/*.conf
    
    
    # Note: instead of adding your own configuration here, consider 
    #       adding it in your own file (/etc/apache2/httpd.conf.local)
    #       putting its name into APACHE_CONF_INCLUDE_FILES in 
    #       /etc/sysconfig/apache2 -- this will make system updates 
    #       easier :)
    If I put the
    Code:
     LoadModule php5_module modules/libphp5.so
    into the httpd.conf I get:
    Code:
    rcapache2 start
    Starting httpd2 (prefork) httpd2-prefork: Syntax error on line 102 of /etc/apache2/httpd.conf: Cannot load /srv/www/modules/libphp5.so into server: /srv/www/modules/libphp5.so: cannot open shared object file: No such file or directory
    
    The command line was:
    /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
                                                                       failed
    Any help greatly appreciated...

  3. #3
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default Re: PHP5 modules not loading in Apache

    I found the answer... one little command:

    Code:
    a2enmod php5
    I saw a link to the only user guide in the world I hadn't looked at when I pasted in the httpd.conf
    Apache Quickstart HOWTO - openSUSE

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP5 modules not loading in Apache

    Or edit /etc/sysconfig/apache2 and add it to the list of modules to be loaded.

  5. #5
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default Re: PHP5 modules not loading in Apache

    Hi,

    Thanks for your reply. Yes, I saw that in one of the help files and didn't pursue it for some reason... Instead, I thought if I refreshed info.php enough it might work eventually It seems to have stayed loaded now so I don't need to do it again. If it turns out at some point that it needs to be loaded again I will put it in there.

    Thanks again,
    /jlar

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP5 modules not loading in Apache

    Yes, if you keep rebooting, maybe the computer will come good.

    That file is read in by Apache every time it starts up so unless you disturb it, it should load that module each time.

  7. #7

    Default Re: PHP5 modules not loading in Apache

    Similar problem. I have tried all the following:

    1. Install (or "Upgrad") apache2-mod_php5 using yast2 successfully.

    2. Input the command "a2enmod apache2-mod_php5" and the system tells me that it's arleady present.

    3. apache2-mod_php5 is included in /etc/sysconfig/apache2 file in APACHE_MODULES.

    4. The response to "httpd2 -M" is as the following (it seems that the module is there)
    ------------------------
    Loaded Modules:
    core_module (static)
    mpm_prefork_module (static)
    http_module (static)
    so_module (static)
    authz_host_module (shared)
    actions_module (shared)
    alias_module (shared)
    auth_basic_module (shared)
    authz_groupfile_module (shared)
    authn_file_module (shared)
    authz_user_module (shared)
    autoindex_module (shared)
    cgi_module (shared)
    dir_module (shared)
    include_module (shared)
    log_config_module (shared)
    mime_module (shared)
    negotiation_module (shared)
    setenvif_module (shared)
    status_module (shared)
    userdir_module (shared)
    asis_module (shared)
    imagemap_module (shared)
    authz_default_module (shared)
    php5_module (shared)
    Syntax OK
    ------------------------


    However, when I start or restart apache2 with "rcapache2 start/restart" command, the system always complains:
    ------------
    Module "apache2-mod_php5" is not installed, ignoring.
    Check the APACHE_MODULES setting in /etc/sysconfig/apache2.
    ------------

    How do I solve the problem? Thanks in advance.

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP5 modules not loading in Apache

    It's just

    Code:
    a2enmod php5
    no need for the long prefix.

    Code:
    /usr/sbin/httpd2 -M
    just shows which modules are present, not which ones are enabled in the config file.

  9. #9

    Default Re: PHP5 modules not loading in Apache

    OK, tried "a2enmod php5" and got the message "php5 already present". The system still shows "Module apache2-mod_php5 not installed, ignoring" when I restart with "rcapache2 restart". Any ideas?

  10. #10
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP5 modules not loading in Apache

    What happens if you try to view a PHP file anyway? Like this one:

    Code:
    <?php
      phpinfo();
    ?>

Page 1 of 3 123 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
  •