Forum Moderators: coopster

Message Too Old, No Replies

PHP under Windows

Running a PHP script on a PC under Windows

         

Scooter24

9:08 pm on Nov 19, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



I read somewhere that you need to install a virtual server (or something like that) if you want to run PHP scripts on a PC. The background is that I'd like to make the pages of my site dynamic, but would like to be able to view the site offline on my computer.

Is there such a piece of software, possibly easy to install? I'm not too familiar with servers.

benihana

9:10 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



firepages.com.au has a bundle that will install apache server, php and mySql with a minimum of fuss.

hope url is ok

ben

sun818

9:11 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi, try a site search on WAMP (Windows Apache mySQL PHP).

Scooter24

11:34 pm on Nov 19, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks, I just installed the server. How do I change the htdocs directory from

C:\Programme\Apache Group\Apache2\htdocs

to

C:\Website\root

where I keep my web pages?

sun818

12:34 am on Nov 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Move your web pages to the htdocs directory. :)

ukgimp

8:54 am on Nov 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



forget all that messing around, if you want a quick install of php, apache, mysql and perl go to :

firepages.com.au

pick last stable version. You will beb up an running quicker than it took to download the file. Unless you are interested in setting up servers this will suffice.

Cheers

Scooter24

12:25 pm on Nov 20, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



Ok, now I installed everything including server, PHP and MySQL - was easier than I thought.

I also found out what to do to change the htdocs directory.

1. In httpd.conf modify the DocumentRoot and <Directory " variables.
2. In php.ini modify the doc_root variable

jackson

5:32 am on Nov 23, 2003 (gmt 0)

10+ Year Member



what are you people trying to do here - sending this guy to quick and uncertain death?

Pardon the drama but having paid a quick visit to firepages they are quite a few ticks behind the curve.

For a start their "latest news" page is dated December 2002. Their "phpdev423 (upgrade at last) [21-10-2002]" contains PHP 4.2.3 which is bug ridden. At least with respect to using getimagesize which returns empty width and height attributes (meaning you don't get to see the image even though it downloads).

Better go to EasyPHP, LAMP or one of the other distributions. The current version of EasyPHP offers PHP 4.3.3, mySQL 4.0.15, Apache 1.3.27 and phpmyadmin 2.5.3 which is as about current as one needs to get at this time of writing.

DaScribbler

6:37 am on Nov 23, 2003 (gmt 0)

10+ Year Member



For people using PHPDev from firepages, I highly recommend you drop it. There hasn't been any real support for it for quite some time.

I recommend either WebServ which you can find via SourceForge, which is an all in one instlaller like PHPDev was.

Or give DeveloperSide.Net a looksee. They've got everything Pre-Bundled with very explicit, yet simple, instructions to install each service on your windows platform. Which I recommend, because it's a simple learning curve for you, and helps you to better understand what you are doing for later reference when you wish to make changes. They also provide step by step instructions for each service individually as well, which makes it simpler when you wish to upgrade just one service (php, perl, apache, mysql, analog etc...)

ergophobe

5:15 pm on Nov 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Good job Scooter! That's the way to do it.

I was going to suggest that you *don't* use one of the quick installs. I would think going through the install step-by-step would give you a better sense of how it all fits together and more options for customization (though I don't know, since I've never used the installer packages).

One word of caution, though. Don't get too upgrade crazy. I could be way outdated, but Apache 2 and PHP still don't play that well together (at least the PHP 4.3.3 install file still has a warning to this effect) and most hosts that you would go to will probably be offering some configuration like

PHP 4.3.4 or perhaps still 4.3.3 since .4 is really new
Apache 1.3.29
MySQL 3.23.59

Ideally, you would want to have your local configuration as close as possible to the one (or ones) that you will be using for live sites.

When you have it all up and running, you should build your first PHP page. It should be exactly three lines long and these are the three lines (only material between the ----- goes in the actual file).

file: info.php
--------------
<?
phpinfo();
?>
----------

Put this in your web root and go to your browser and type in
[localhost...]

This will give you enough information about your install that it will likely take you months before you know what it all means ;-)

Have fun.

Scooter24

11:18 am on Nov 24, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks, I have already tested PHP and it works fine. But it seems that Apache isn't capable of displaying .shtml files - it keeps showing the source code when I enter a .shtml page into the address line of the browser. What can I do?

ergophobe

7:16 pm on Nov 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Search your Apache httpd.conf file for these two lines

#AddType text/html .shtml
#AddHandler server-parsed .shtml

Uncomment then (remove the hash mark). That should do it.

Scooter24

9:41 am on Nov 25, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



I found the
#AddType text/html .shtml

line and uncommented, but instead of

#AddHandler server-parsed .shtml

I found

#AddOutputFilter INCLUDES .shtml

There is no AddHandler server-parsed .shtml line. What should I do?

hayseed

12:19 am on Nov 26, 2003 (gmt 0)

10+ Year Member



Hi Scooter24,

I just installed WAMP using Apache 1.3.26 and my httpd.conf looks like this:

# Document types.
#
<IfModule mod_mime.c>
.
.
# To use server-parsed HTML files
#
#AddType text/html .shtml
#AddHandler server-parsed .shtml
.
.
</IfModule>

I'm not sure which version of Apache you're using, but from my recollection of having installed Apache <= 1.3.26 the syntax has remained the same. Which would mean that you just have to uncomment the 'AddType' line and add the 'AddHandler' line if it doesn't already exist somewhere within the 'mod_mime.c' module definition section of your config. Unless you're using Apache >=2.x in which case I could be way off base as I haven't looked at the default httpd.conf for those versions. HTH.

jatar_k

12:22 am on Nov 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld hayseed

try adding the line specified Scooter24, you can always take it out again. ;)

Scooter24

9:05 am on Nov 26, 2003 (gmt 0)

10+ Year Member Top Contributors Of The Month



Indeed the Apache version I have is 2.0.48

Anyway, shtml files are now correctly recognised, even without the Addhandler line.