[BenQuick.com/.co.uk]

Main stuff
Home
Announcements
Bookmarks
Contact me
GTA
Warcraft 2
WebRings

School stuff
Prom 2001

Randomness
Amazon WishList
Chainmail
Jokes
Tech Support
The end
Virus Warnings

Life stuff
Life Instructions
Meangingful Quotes
Friends?
Emotions?
Meanging of life

Site stuff
The MailBag
Links
Add Link
Disclaimer

Tech stuff
HTML tutorial
Installing Apache
Installing MySQL
Installing PHP
Website password protection
  PHP, what?

PHP, according to the official PHP site, is "a server-side, cross-platform, HTML embedded scripting language."

Say what?

All that means is, PHP does its stuff on the server. Which in turn means - By the time you see a PHP page, it's already been processed, you see the result(s) of the processing. Cross platform just means you can use it on pretty much any computer

Well, that was fun. No?

PHP - What on earth does it stand for?
Depending on who you ask, it can mean one of 2 things
1)Pre-Hypertext Pre-processor
2)Personal HomePage
Now, being honest, it wasn't all that interesting, was it?

On with the show

PHP is available from PHP.net, currently (09/04/01) the latest version is 4.0.4pl1. Available from PHP's downloads page. As with essentially all open-source projects, you can download the sourcecode and compile your own version of PHP. If you're reading this tutorial, I'll assume you wouldn't want to compile. So, I reccomend you download a PHP binary

Now, go and make a cup of tea while you wait for this to download, it's almost 4Mb

Why are we downloading this 4Mb version, when there's a 735Kb version? Well, the smaller version is for the CGI version of PHP, and you don't have any additional extentions. I don't like the CGI version, because every PHP page you make has to (server dependent) be in a cgi-bin, and written with a shebang (#!/usr/local/bin/php). Of course, feel free to download that version, but don't expect any help from me :p

Downloaded

You need to unzip PHP (I use WinZip for this) to somewhere, I chose e:\php
You need to copy (Or move) the file php4ts.dll from where it is, to c:\windows\system

We need to edit Apache's httpd.conf now. So, stop Apache, and open httpd.conf. Find the
<IfModule mod_mime.c>
[...]
</IfModule>

block in httpd.conf and either uncomment or add the following
AddType application/x-httpd-php .php4 .php

No, go and find the big group of LoadModule's and add
LoadModule php4_module e:/php/sapi/php4apache.dll
to it. Changing the path to suit, of course

Go back to the directory you installed PHP, and find php.ini-dist, rename it to php.ini then copy it to your windows directory

Now then, I don't fully understand the php.ini, so I'm unable to explain it, really. I can, however, show you what I'm using, and it works for my needs


- BEGIN -
[PHP]

engine           = On
short_open_tag   = On
asp_tags         = Off
precision        = 14
y2k_compliance   = Off
output_buffering = Off

implicit_flush                 = Off
allow_call_time_pass_reference = On

safe_mode                  = Off
safe_mode_exec_dir         =
safe_mode_allowed_env_vars = PHP_

safe_mode_protected_env_vars = LD_LIBRARY_PATH

highlight.string   = #DD0000
highlight.comment  = #FF8000
highlight.keyword  = #007700
highlight.bg       = #FFFFFF
highlight.default  = #0000BB
highlight.html     = #000000

expose_php         = On
max_execution_time = 30
memory_limit       = 8M

error_reporting         = E_ALL & ~E_NOTICE
display_errors          = On
display_startup_errors  = Off
log_errors              = On
track_errors            = Off
error_prepend_string    = "&th;font color=ff0000>"
error_append_string     = "</font>"
error_log               = phperr.log
warn_plus_overloading   = Off

variables_order         = "EGPCS"
register_globals        = On
register_argc_argv      = On
post_max_size           = 8M
gpc_order               = "GPC"

magic_quotes_gpc        = On
magic_quotes_runtime    = Off
magic_quotes_sybase     = Off
default_mimetype        = "text/html"

extension_dir       = e:/php/extentions/
enable_dl           = On				
file_uploads        = On
upload_max_filesize = 2M

allow_url_fopen = On

[Syslog]
define_syslog_variables	= Off

[mail function]
SMTP            = localhost
sendmail_from   = me@localhost.com

[Debugger]
debugger.host    = localhost
debugger.port    = 7869
debugger.enabled = False

[SQL]
sql.safe_mode    = Off

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent   = -1
mysql.max_links        = -1

[bcmath]
bcmath.scale = 0

[Session]
session.save_handler      = files
session.save_path         = /tmp
session.use_cookies       = 1
session.name              = PHPSESSID
session.auto_start        = 0
session.cookie_lifetime   = 0
session.cookie_path       = /
session.serialize_handler = php
session.gc_probability    = 1
session.gc_maxlifetime    = 1440
session.entropy_length    = 0
session.cache_limiter     = nocache 
session.cache_expire      = 180     
session.use_trans_sid     = 1       
url_rewriter.tags         = "a=href,area=href,frame=src,input=src,form=fakeentry"

[Verisign Payflow Pro]
pfpro.defaulthost    = "test.signio.com"
pfpro.defaultport    = 443
pfpro.defaulttimeout = 30

[Sockets]
sockets.use_system_read	= On
-  END  -


Right then, start Apache (apache -k start again). Now, if you run Apache from a dos box (rather than as a service) you'll see
Apache 1.3.xx (Win32) PHP/4.0.4pl1 running...

Which simply means Apache and PHP are getting along nicely. But, just as a double check: -
1) Create a file, info.php, in your document root
2) In that file, add the following
<? phpinfo() ?>
3) Goto http://127.0.0.1/info.php
My version of that is available here. And, well, if you've got this far without a hitch, you're sorted. PHP works!
  [Home] [Announcements] [Bookmarks] [Contact me] [GTA] [Warcraft 2] [WebRings] [Amazon WishList] [Chainmail] [Jokes] [Tech Support] [The end] [Virus Warnings] [HTML tutorial] [Installing Apache] [Installing MySQL] [Installing PHP] [Website password protection] [Life Instructions] [Meangingful Quotes] [Friends?] [Emotions?] [Meanging of life] [The MailBag] [Links] [Add Link] [Disclaimer]
© Ben Quick 2000