PHP & Apache Installation
Results 1 to 5 of 5

Thread: PHP & Apache Installation

  1. #1
    Junior Member
    Join Date
    Jul 2003
    Posts
    12

    PHP & Apache Installation

    As new to Web Development I had some problems installing PHP with Apache Web Server. So I hope this can help you:

    Installing Apache:
    1 - Go to http://www.apache.org/dist /binaries/win32/ and download the latest version.This file is pre-compiled and ready to install.
    2 - Run the executable file by double-clicking it
    3 - The installation wizard will start
    4 - The installation wizard will ask for the Apache installation directory. The default is "C:\Program Files\Apache Group\Apache" but you can change this to "C:\Apache\" or anything else.
    5 - The installation wizard will ask for the name that will appear in the Start menu. The default is "Apache Web Server".
    6 - The installation wizard will ask for the installation type: typical, minimum or custom. The "typical" install is, well, typical, so go ahead and choose that one.

    During the installation process, a default set of configuration files will be placed in the "conf" directory, which lives within the installation directory (i.e. "C:\Program Files\Apache Group\Apache\conf\"). If you make a few minor changes to the httpd.conf file (the master Apache configuration file), you can start Apache and prove that it's working properly.

    In your text editor of choice, open httpd.conf and find a line starting with:

    ServerAdmin

    Modify this entry and provide your own information, such as:

    ServerAdmin joe@schmo.com

    Next, find a line starting with:

    #ServerName

    Take away the "#" and change this entry to real values, such as:

    ServerName localhost

    If you have a real machine name, like mybox.yourdomain.com, go ahead and use it instead of localhost:

    ServerName mybox.yourdomain.com


    Get PHP running:

    1 - Go to the "Downloads" area at http://www.php.net/
    2 - Once you have the file on your hard drive, use your favorite un-zipping tool to extract the contents to, say, C:\php4\
    3 - Take the file called "php.ini-dist", rename it to "php.ini" and move it to C:\WINDOWS\ or wherever the rest of your *.ini files live.
    4 - Take the two files "Msvcrt.dll" and "php4ts.dll", and put them in C:\WINDOWS\SYSTEM\ or wherever you usually put your *.dll files. If your system tells you that you already have "Msvcrt.dll" or it's currently in use, that's fine. As long as you have it.

    You'll need to go back to the Apache httpd.conf and make a few modifications to tell Apache what to do with *.php or *.phtml files (and how to do it).

    With httpd.conf open in your text editor, find a section that looks like the following:

    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the realname directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client. The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"

    You need to add another ScriptAlias line to the end, just like this:

    ScriptAlias /php4/ "C:/php4/"

    Now find a section that looks like this:

    # AddType allows you to tweak mime.types without actually editing it, or to
    # make certain files to be certain types.
    #
    # For example, the PHP3 module (not part of the Apache distribution)
    # will typically use:
    #
    #AddType application/x-httpd-php3 .phtml
    #AddType application/x-httpd-php3-source .phps

    Although the example is now out-of-date, since you'll be using PHP4, you get the idea. This is the area where you say "for all files ending with [whatever], consider them to be of [whatever] type." If you want to create your own file extension for PHP files, like .joe (really, you can), add .joe after the .php and .phtml in the first AddType line.

    The section should now look something like this:

    # AddType allows you to tweak mime.types without actually editing it, or to
    # make certain files to be certain types.
    #
    # For example, the PHP3 module (not part of the Apache distribution)
    # will typically use:
    #
    #AddType application/x-httpd-php3 .phtml
    #AddType application/x-httpd-php3-source .phps

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

    TIP: If you want to parse *.html files as PHP, just add the file extension to the list in your AddType line, so that it ends up looking like this:

    AddType application/x-httpd-php .php .phtml .html

    And now one last modification. Find a section like this:

    #
    # Action lets you define media types that will execute a script whenever
    # a matching file is called. This eliminates the need for repeated URL
    # pathnames for oft-used CGI file processors.
    # Format: Action media/type /cgi-script/location
    # Format: Action handler-name /cgi-script/location
    #

    You need to include an Action line for your new file types, so that they automatically get sent through the PHP parser. So add this:

    Action application/x-httpd-php /php4/php.exe


    If you want to test your PHP installation write <? phpinfo() ?> on your text editor and save the file as .php and run it!

    I tried a software pack : OpenSA Web Server (www.opensa.org) it's easy and fast but has some problems namely with uploading files.

    I konw it's long, I hope it will be useful!
    Figo

  2. #2
    Just a Virtualized Geek MrLinus's Avatar
    Join Date
    Sep 2001
    Location
    Redondo Beach, CA
    Posts
    7,324
    http://hotwired.lycos.com/webmonkey/...tw=programming <-- original source.

    Tutorials are supposed to be original.
    Goodbye, Mittens (1992-2008). My pillow will be cold without your purring beside my head
    Extra! Extra! Get your FREE copy of Insight Newsletter||MsMittens' HomePage

  3. #3
    Junior Member
    Join Date
    Jul 2003
    Posts
    12
    Yes you're right I should have written my source. But I think it's useful if you don't know the site.
    Do you think I shouldn't do this anymore? Sorry I'm new to this.
    Thanks!
    Figo

  4. #4
    Just a Virtualized Geek MrLinus's Avatar
    Join Date
    Sep 2001
    Location
    Redondo Beach, CA
    Posts
    7,324
    No problem offering locations that might be of use but put it in the appropriate forum.
    Goodbye, Mittens (1992-2008). My pillow will be cold without your purring beside my head
    Extra! Extra! Get your FREE copy of Insight Newsletter||MsMittens' HomePage

  5. #5
    Senior Member
    Join Date
    Aug 2003
    Posts
    300
    MsMittens - All over this. I was looking at the thread and as I read the first section it seemed familiar. I checked some of my favs and believe it or not. Nice Catch Ms!



    - Adiz

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides