Web Analytics Made Easy -
StatCounter Configure PHP 4.3.4 for both IIS and Apache - CodingForum

Announcement

Collapse
No announcement yet.

Configure PHP 4.3.4 for both IIS and Apache

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configure PHP 4.3.4 for both IIS and Apache

    Hi All,

    Is it possible to configure PHP 4.3.4 for both IIS and Apache. That is, so I can switch from IIS to Apache and PHP will work with both servers?

    At present PHP and Mysql works fine with IIS so I'm cautious about playing with the configuration to try to find out, hence the question.

    Regards

    Gary

  • #2
    Hi , yes you can & you wont need to modify your PHP nor MySQL installation as its simply a matter of configuring Apache.

    Note if you downloaded the PHP installer file from php.net then AFAIK you won't have all the required dll's , you will need to grab the zip file (of the same version!) , you only actually need the apache sapi (php4apache.dll or php4apache2.dll depending on your version)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

    Comment


    • #3
      Hi Firepages,

      Thanks for this information. I didn't realise it would be so simple. I'll go and get the zip file.

      Regards

      Gary

      Comment


      • #4
        Hi Firepages,

        OK, I have copied the php4apache.dll into the windows/system32 subdirectory as this is where I found php4ts.dll

        Apache does not yet read php files. Do I need to 'register' the new dll? I have been through the httpd.conf file looking for references to php but no luck yet.

        How do I configure apache to recognise it's dll?

        Regards

        Gary

        Comment


        • #5
          Hi , in your /apache/conf/httpd.conf

          after the last `LoadModule` entry , add a these 2 lines ...
          Code:
          LoadModule     php4_module "c:/windows/system32/php4apache.dll"
          addtype application/x-httpd-php .php .php4 .php3 .htm .inc
          (add/remove whatever file associations you want)
          save the conf , restart apache and cross your fingers !
          resistance is...

          MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

          Comment


          • #6
            Hi Firepages,

            No luck I'm afraid. Do I need to add anything to the following 'AddModule' section?

            Regards

            Gary

            Comment


            • #7
              not unless you have a version of apache with php compiled as a static module

              open a command prompt and cd to your apache directory..
              type

              apache -l

              if the returned data includes mod_so then you should be ok to load as noted above , then type

              apache -t

              which runs a httpd.conf syntax check and may give some useful info
              resistance is...

              MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

              Comment


              • #8
                Hi Firepages,

                Here is the LoadModule and AddModule extract from my httpd.conf file showing the two additional lines of code you sent me.

                # Example:
                # LoadModule foo_module modules/mod_foo.so
                #
                #LoadModule vhost_alias_module modules/mod_vhost_alias.so
                #LoadModule mime_magic_module modules/mod_mime_magic.so
                #LoadModule status_module modules/mod_status.so
                #LoadModule info_module modules/mod_info.so
                #LoadModule speling_module modules/mod_speling.so
                #LoadModule rewrite_module modules/mod_rewrite.so
                #LoadModule anon_auth_module modules/mod_auth_anon.so
                #LoadModule dbm_auth_module modules/mod_auth_dbm.so
                #LoadModule digest_auth_module modules/mod_auth_digest.so
                #LoadModule digest_module modules/mod_digest.so
                #LoadModule proxy_module modules/mod_proxy.so
                #LoadModule cern_meta_module modules/mod_cern_meta.so
                #LoadModule expires_module modules/mod_expires.so
                #LoadModule headers_module modules/mod_headers.so
                #LoadModule usertrack_module modules/mod_usertrack.so
                #LoadModule unique_id_module modules/mod_unique_id.so
                LoadModule php4_module "c:/windows/system32/php4apache.dll"
                addtype application/x-httpd-php .php .php4 .php3 .htm .inc

                #
                # Reconstruction of the complete module list from all available modules
                # (static and shared ones) to achieve correct module execution order.
                #
                # The modules listed below, without a corresponding LoadModule directive,
                # are static bound into the standard Apache binary distribution for Windows.
                #
                # Note: The order in which modules are loaded is important. Don't change
                # the order below without expert advice.
                #
                # [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]
                ClearModuleList
                #AddModule mod_vhost_alias.c
                AddModule mod_env.c
                AddModule mod_log_config.c
                #AddModule mod_mime_magic.c
                AddModule mod_mime.c
                AddModule mod_negotiation.c
                #AddModule mod_status.c
                #AddModule mod_info.c
                AddModule mod_include.c
                AddModule mod_autoindex.c
                AddModule mod_dir.c
                AddModule mod_isapi.c
                AddModule mod_cgi.c
                AddModule mod_asis.c
                AddModule mod_imap.c
                AddModule mod_actions.c
                #AddModule mod_speling.c
                AddModule mod_userdir.c
                AddModule mod_alias.c
                #AddModule mod_rewrite.c
                AddModule mod_access.c
                AddModule mod_auth.c
                #AddModule mod_auth_anon.c
                #AddModule mod_auth_dbm.c
                #AddModule mod_auth_digest.c
                #AddModule mod_digest.c
                #AddModule mod_proxy.c
                #AddModule mod_cern_meta.c
                #AddModule mod_expires.c
                #AddModule mod_headers.c
                #AddModule mod_usertrack.c
                #AddModule mod_unique_id.c
                AddModule mod_so.c
                AddModule mod_setenvif.c


                Having saved this file, I fired up apache, opened a command prompt window and entered the commands you listed. This is what I get:

                D:\Apache>apache -l
                Compiled-in modules:
                http_core.c
                mod_so.c
                mod_mime.c
                mod_access.c
                mod_auth.c
                mod_negotiation.c
                mod_include.c
                mod_autoindex.c
                mod_dir.c
                mod_cgi.c
                mod_userdir.c
                mod_alias.c
                mod_env.c
                mod_log_config.c
                mod_asis.c
                mod_imap.c
                mod_actions.c
                mod_setenvif.c
                mod_isapi.c

                D:\Apache>

                D:\Apache>apache -t
                d:/apache/conf/httpd.conf: Syntax OK
                [Sun Feb 08 10:12:51 2004] [error] Cannot remove module mod_php4.c: not found in module list

                D:\Apache>

                mod_so.c is listed OK but what is the "Cannot remove module mod_php4.c: not found in module list" error message telling us?

                I notice that all modules end in ".c" Is this relevant.

                What should I try next, please.

                Regards

                Gary

                Comment


                • #9
                  Hi Firepages,

                  Fixed it!

                  I added "AddModule mod_php4.c" to the bottom of the AddModule section of httpd.conf and php all worked.

                  Thanks for all your help. Couldn't have fixed this without you.

                  Regards

                  Gary

                  Comment

                  Working...
                  X