Installing PHP on Windows XP

PythonPython Forum LeaderThe Royal RAM
Well in my room I have this PC which isnt connected to the internet. Now instead of me just using it to play games and to create random and rubbish web designs it would be better if I put it to some use.

How can I install PHP on it so that i can run PHP scripts?

Because i want to learn PHP and this would be a good place where i good try stuff out and practice my scripts.

Thnx

The Royal Ram

Comments

  • tonytony Moderator Administrator
    you will need IIS or another program forgot what it is called though installed on your computer (it might be apache)
    what operating system have you got on the computer?
  • PythonPython Forum Leader The Royal RAM
    its Windows XP

    The Royal Ram

  • tonytony Moderator Administrator
    pro or home edition?
  • PythonPython Forum Leader The Royal RAM
    ahhhh errrrm, pro

    The Royal Ram

  • tonytony Moderator Administrator
    go to start - programs - administrative toold - then look for Internet Informations Systems (IIS)

    you need that installed to be able to run php - this is where i dropped out of uni so i cant be much more help now i dont know how you set it up how you do anything with it but i know you should have a file called wwwroot on your computer somewhere and your php should be kept in that
  • PythonPython Forum Leader The Royal RAM
    hmmm. does anyone else know anything about it?

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    Forget IIS, Apache works perfectly on Windows (and with less of the overhead).

    Go download Apache2 and install. Then go download PHP (Zip archive). You can read the Install.txt file, but in a nutshell what you want to do (installing PHP as a SAPI module):

    1. Extract the PHP archive
    2. Copy php4apache2.dll and php4ts.dll and php.ini to your Apache2 directory.
    3. Open up conf/httpd.conf and add these lines to the bottom:
    [code:1:ece3d40b97]LoadModule php4_module php4apache2.dll
    AddType application/x-httpd-php .php[/code:1:ece3d40b97]

    You might want to stay away from PHP5 until at least the next release, there are a few annoying bugs that'll kill some stuff.
  • PythonPython Forum Leader The Royal RAM
    thanks for that. ill try it later

    The Royal Ram

  • PythonPython Forum Leader The Royal RAM
    well i tried it and when i go to test the configuration setting sof rapache it says that there is invalid syntax on line 971 - which is where i placed that bit of code in conf/httpd.conf


    this is really confusing!

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    Did you download PHP 5 or PHP 4?
  • PythonPython Forum Leader The Royal RAM
    PHP 4

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    That's odd. What's the exact error message, is there any more info other then "line 971"?
  • PythonPython Forum Leader The Royal RAM
    it just says that there is invalid syntax on line 971

    thats about it

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    And you got Apache2 right? Wow, that's really odd >< If you remove the lines, does Apache start up fine?
  • PythonPython Forum Leader The Royal RAM
    ok well apache the actual program is already started because its down in the taskbar(bottom right) but it says that its not actually running the service.

    so because it wont start running it i went to test configuration and i got that error.

    oooo sweet. ok i took away those lines and apache is running fine and its running the service.

    but how does php come in to this?

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    The thing in the notification area is just the Apache service monitor, you can even exit that if you want.

    You have to tell Apache to load PHP as a module, which is what those lines are supposed to do. Not sure why it's giving you an error. Even if the were missing files somewhere, it'd complain about missing files, not syntax errors. Here, even read the install:
    Web server configuration
    ========================

    Installing PHP on Windows with Apache 1.3.x

    ATTENTION: Apache 2 Users

    At this time, support for Apache 2 is experimental. It's
    highly recommended you use PHP with Apache 1.3.x and not
    Apache 2. Documentation for installing Apache 2 on windows
    can be seen here:

    http://www.php.net/manual/en/install.apache2.php

    With the basic difference being that when installing as a
    module you'll use php4apache2.dll instead of php4apache.dll
    Both files are included within this release.


    There are two ways to set up PHP to work with Apache 1.3.x
    on Windows. One is to use the CGI binary (php.exe),
    the other is to use the Apache module dll. In either case
    you need to stop the Apache server, and edit your
    httpd.conf or srm.conf to configure Apache to work with PHP.
    We'll refer to either of these files with httpd.conf in the
    text.

    Although there can be a few variations of configuring PHP
    under Apache, these are simple enough to be used by the
    newcomer. Please consult the Apache Docs for further
    configuration directives.


    Installing PHP for Apache as module
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Now that version 4.1 introduces a safer sapi module, we recommend
    that you configure PHP as a module in Apache.

    To accomplish this, you have to load the php4apache.dll in your
    Apache httpd.conf.

    !! NOTE !!
    Whereever you load php4apache.dll from, php4apache.dll also
    needs the php4ts.dll also included in the PHP4 distribution.
    php4apache.dll depends on php4ts.dll which is loaded as soon as
    Apache loads php4apache.dll. If php4ts.dll can't be found, you
    usually get an error like (also see the "Problems?" section at
    the end of the file):

    Cannot load c:/php/sapi/php4apache.dll into server

    So where does php4ts.dll has to be to be properly loaded ?
    php4ts.dll is searched in the following order:

    1) in the directory where apache.exe is start from
    2) in the directory where php4apache.dll is loaded from
    3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and
    %SYSTEMROOT% directory.
    Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
    4) in your whole %PATH%

    Note: What is %SYSTEMROOT% ? Depending on your Windows
    installation this may be for example c:\winnt or C:\windows

    Usually you would just copy it over to %SYSTEMROOT%\System32.
    But if you want to have multiple PHP installations (for
    whatever reason) this is a bad idea. For this circumstance the
    safest thing is to let php4ts.dll reside in the same directory
    where php4apache.dll is loaded from (see point 2 above).


    After you've set up the file layout properly, you're ready to
    finally configure Apache to load the PHP4 module. Just add the
    following lines to your httpd.conf:

    LoadModule php4_module c:/php/sapi/php4apache.dll
    AddModule mod_php4.c
    AddType application/x-httpd-php .php

    Note: Especially newer versions of Apache do not need the
    AddModule directive anymore, your milage may vary.


    Where do I have to put the php.ini ?
    The php.ini files is only searched in two places:
    1) in your Apache installation directory (e.g. c:\apache\apache)
    2) in your %SYSTEMROOT% directory.


    Installing PHP for Apache as CGI binary
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If you wish to install PHP as a CGI binary, read this first:

    http://www.cert.org/advisories/CA-1996-11.html

    and then if you are really sure, insert these lines to your conf file:

    ScriptAlias /php/ "c:/php/"
    AddType application/x-httpd-php .php
    Action application/x-httpd-php "/php/php.exe"

    Note, we consider installing PHP like this suicidal.

    As a further precaution, we recommend you change the "/php/"
    ScriptAlias to something more random, to prevent the binary being
    called directly, which is a security risk.

    Remember when you have finished to restart the server, for example,
    NET STOP APACHE
    followed by
    NET START APACHE

    To use the source code highlighting feature, add the following
    line to your apache httpd.conf file:

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

    Note, this will only work when you install php as a sapi module.
    If you wish to use this feature with the cgi binary, create a new
    file, and use the show_source("path/to/original_file.php"); function.


    Forward or backslash in pathnames ?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    On Win-Apache, path names can contain either forward- or backslashes.
    Example:

    LoadModule php4_module C:\php\sapi\php4apache.dll

    works as good as

    LoadModule php4_module C:/php/sapi/php4apache.dll

    You even can mix the slash-style:

    LoadModule php4_module C:\php/sapi\php4apache.dll
  • PythonPython Forum Leader The Royal RAM
    ill try moving php4ts.dll into the system root/System32 instead of it being in the same place as apache.exe

    maybe it just cant load the dll

    The Royal Ram

  • ChroderChroder Senior Member The Royal RAM
    Maybe, but it'd complain about "cannot find such and such", not a syntax error.
  • PythonPython Forum Leader The Royal RAM
    well i tried it and same thing...


    im gonna uninstall apache totally and start over. maybe i messed something up but i doubt it.

    The Royal Ram

  • rtwrtw Beginner Link Clerk
    I was able to install a service that emulates a webserver as well as PHP4 on Windows XP, independently being Pro or Home (and everything almost with just clicking a button PLUS I am talking free-ware): just go to http://www.freeguppy.org/ and get the freeGuppY package.

    I hope that helps. :rolleyes:
  • kinkkink serious member VPS - Virtual Prince of the Server
    before you do all that maybe check out the microsoft site to see what is needed
Sign In or Register to comment.