thanx for the reply!

anyway, nope I don't see an AddType inside httpd.conf file. Should be inside httpd.conf or any other file?

(honestly I'm bit confused with Apache's new "many file" configuration system 🙂)

    Only what I read in the manual: take the trailing slash off your dir, and add the addtype directive

    # For PHP 5 do something like this:
    LoadModule php5_module "c:/php/php5apache2.dll"
    AddType application/x-httpd-php .php
    
    # configure the path to php.ini
    "C:/Program Files/PHP"

    I do know (remember now, it's been years) you need the addtype directive in httpd.conf to tell apache to handle any new file extention like .php .dhtml etc

      If you visit the manual page [man]install.windows.apache2[/man], you'll see the proper syntax to associate .php files with the PHP parser is (in httpd.conf):

      AddType application/x-httpd-php .php

      If you find you are having problems, you might try installing PHP in a location that doesn't contain spaces in the path, e.g. c:\php\ as you'll note the manual page [man]install.windows.manual[/man] notes:

      expands to a foldername like php-4.3.7-Win32. If you are installing PHP 5, extract to C:\php as the zip file doesn't expand as in PHP 4. You may choose a different location but do not have spaces in the path (like C:\Program Files\PHP) as some web servers will crash if you do.

      And finally, I would recommend you look over the two manual pages I've linked - make sure you've done all of the steps they mention.

        thanks!

        Roger, I guess the way you told me is for PHP 5.1 and Apache 2.x right? I know there shouldn't be any huge diff between these new versions. However this is a extraction from my httpd.conf file

        #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
        PHPIniDir "C:/Program Files/PHP/"
        LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
        AddType application/x-httpd-php php
        AddType application/x-httpd-php-source phps
        #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

        and this is an extraction from mime.types file

        application/x-httpd-php		php
        application/x-httpd-php-source	phps

        well, isn't this new mime.types file is a replacement kind of thing for AddType directive?

        sorry about my lack of knoledge :glare:

          Just to make sure - did you restart Apache after making these changes?

            Thanks for the URL!

            Well I uninstall PHP and installed again to C:\PHP. This is my new httpd.conf. Still the same,

            #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
            PHPIniDir "C:/PHP/"
            LoadModule php5_module "C:/PHP/php5apache2_2.dll"
            AddType application/x-httpd-php php
            AddType application/x-httpd-php-source phps
            #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

            But PHP 5.2.1's installer defaults to "Program Files". Strange! 😕 See the image.

              yup, restarted. All I can see is a white page with my source code (right click, view source)

                What is the LogLevel directive set to in httpd.conf ? Have you checked the error.log logfile for any relevant info?

                EDIT: At this point, it might be easier to download the .zip file and install PHP manually. I'm sure someone will come along soon (Houdini, perhaps?) and recommend XAMP to get you started, though I've always agreed with PHP.net and set PHP up manually myself.

                  Well this is the error.log file (contains only small number of records, cuz it's a new install). I don't see any wired stuff. I tried PHP CGI as well (top of the file)

                    Yep, it was for 5 and 2.

                    You still have not taken the trailing / from the inidir path - it's in the user notes at the manual page that Brad linked to.

                      Hi everybody!

                      well finally after losing many hours (I'm an idiot :eek: ) I've decided to use Apache 2.0.59 and re-installed PHP 5.2.1 as a module (php5apache2.dll). Works fine now and I'm happy! :p

                      This is the PHP section from my conf/httpd.conf file,

                      #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
                      PHPIniDir "C:\\Program Files\\PHP\\"
                      LoadModule php5_module "C:\\Program Files\\PHP\\php5apache2.dll"
                      #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

                      and this is the PHP section from conf/mime.types

                      application/x-httpd-php	php
                      application/x-httpd-php-source	phps

                      once again, thank you everybody! much appreciated!

                        velanzia wrote:

                        Hello Everybody

                        I recently did an update for my Apache server and PHP versions. Installed Apache 2.2.4 (win) and then installed PHP 5.2.1 (Win). I let PHP to configure Apache. It automatically added,

                        PHPIniDir "C:/Program Files/PHP/"
                        LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

                        to httpd.conf file and added,

                        application/x-httpd-php		php
                        application/x-httpd-php-source	phps

                        to mime.types file.

                        but when I try to run a PHP file, all I see is a big white page 😕 and I can see all my PHP source code when I view source! I believe PHP handler not setup correctly?

                        Can anyone please help me with this issue? Thank you everybody!

                        I am successfully running Apache 2.2.4 + PHP 5.2.0 in my Windows XP machine.

                        I am have almost the same configuration in my Apache:

                        in 'httpd.conf':
                        LoadModule php5_module "C:/php/php5apache2_2.dll"

                        PHPIniDir "C:/php/"

                        in 'mime.types':
                        application/x-httpd-php php
                        application/x-httpd-php-source phps

                        The only thing I can think of is
                        that you should make sure that those PATHs
                        is where php is installed
                        In my case this is the default C:/php/

                        🙂 It is a true observation, that in newer Apache servers ( Apache 2.2.4 )
                        there is no longer need to use AddType for PHP.
                        Instead this PHP and PHPS types are, like most other file types,
                        now added in the file: mime.types

                        Regards

                          Adding those lines to mime.types or the AddType lines to httpd.conf do the exact same thing, though...

                            Write a Reply...