Installing PHP

  • 格式:doc
  • 大小:1.95 MB
  • 文档页数:26

Installing PHP

Contents

 Overview

o Installing Apache

Upgrade from Apache 2.0.55 (and up)

o Installing PHP

Upgrade from PHP5.1.2 and up

 Installing MySQL

o Other stuff

Zend Optimizer

 Copyright / Misc.

Overview

First things first:

This tutorial will show you how to install Apache2 with PHP5 and MySQL in the intention to use it for

DEVELOPEMENT!

We will need Apache, PHP and MySQL.

Apache's newest version for Windows is 2.0.58(recommended) and 2.2.2 Download (Download the .msi install

package)

PHP's newest version is 5.1.4 Download (Download the zip package & the PECL modules collection)

MySQL's newest version is 5.0.22 Download (Download the one described as "Windows (x86)")

[TOP]

Installing Apache

The .msc installer makes this easy. Run the installer:

Next...

Agree...

If the fields weren't filled-in automatically filled-in you'll have to fill them in yourself.

The option "for All Users..." should be selected

Next...

Click on Change...

I've set my path to C:\Server ... feel free to set it to whatever you like

I might add that the install always creates a folder called "Apache2" so you don't need to add a "apache" folder.

If you do you'll end up with a path like "C:\Server\Apache\Apache2".

NOTE: The problem with the path has been fixed in Apache 2.2.2. Install it in C:\Server\Apache2!

Install...

Wait a bit.

Done!

Ok now we'll check if if you'd done it right. A handy tool should have been installed with the server. It's a

feather-like icon on the task bar. Right-click and select "Open Apache Monitor".

If the icon next to "Apache2" is green then apache should be running.

Now visit http://localhost/ (or http://127.0.0.1/).

You should see somethikng like this:

It works!

Ok now we'll change a few settings to move the folder in which the web files are stored - the Document Root. (this

part is optional but it makes it make things easier).

Find:

DocumentRoot "C:/Server/Apache2/htdocs"

and change it to

DocumentRoot "C:/Server/htdocs"

 Find:

 and change it to whatever you changed the line above to

You have to make sure thet the folder you specified exists and restart apache. Just open thae Apache Monitor and

click on "Restart".

[TOP]

Upgrade Apache

Just Go to Control Panel -> Add or Remove Programs, find Apache and uninstall it. I recommend you to re-do the

httpd.conf editing.

Delete your old Apache folder.

Follow the Apache installation guide to install the new version.

If you had PHP installed you'll have to copy some files to your Apache directory, as described in the PHP

installation guide.

If you have decided to use Apache2.2.2 you'll have to take the additional Apache2.2.x PHP installation step.

Installing PHP

This part of the tutorial assumes you have Apache2 already installed.

After downloading the two zip files extract the first on (the one WITHOUT "pecl" in it's name) to C:\Server\ (You

can choose wahtever folder you like but it's a good idea to have it all in one place.

After extracting it and rename the folder to "php".

Now Extract the second .zip file to C:\Server\php\ext\. Just copy everything. Go back to C:\Server\php and rename the file "php.ini-dist" to "php.ini"

Edit the php.ini:

Find:

error_reporting = E_ALL & ~E_NOTICE

and change it to

error_reporting = E_ALL

 Find:

display_startup_errors = Off

 and change it to

display_startup_errors = On

 (optional; See Manual) Find:

track_errors = Off

 and change it to

track_errors = On

 Find:

;arg_separator.output = "&"

 and change it to

arg_separator.output = "&"

 Find:

register_long_arrays = On

 and change it to register_long_arrays = Off

(improtant) Magic Quotes are very annoying

Find:

magic_quotes_gpc = On

 and change it to

magic_quotes_gpc = Off

 (improtant) Extensions (this is needed if you want to use a database... or gd)

Find:

extension_dir = "./"

 and change it to

extension_dir = "C:\Server\php\ext"

 It should point to the ext folder. If you've extracted php to another directory the path should be different.

 Find:

;extension=php_mbstring.dll

;extension=php_bz2.dll

;extension=php_curl.dll

;extension=php_dba.dll

;extension=php_dbase.dll

;extension=php_exif.dll

;extension=php_fdf.dll

;extension=php_filepro.dll

;extension=php_gd2.dll

;extension=php_gettext.dll

;extension=php_ifx.dll

;extension=php_imap.dll

;extension=php_interbase.dll

;extension=php_ldap.dll

;extension=php_mcrypt.dll

;extension=php_mhash.dll

;extension=php_mime_magic.dll

;extension=php_ming.dll

;extension=php_mssql.dll

;extension=php_msql.dll

;extension=php_mysql.dll

;extension=php_oci8.dll

;extension=php_openssl.dll

;extension=php_oracle.dll