Hello, Thursday, June 9, 2005, 1:47:41 PM, you wrote: aan> 1st issue. When I installed Apache, the installation program aan> self-configures. Since I use a permanent, broadband connection, I aan> think Apache detected it and assumed I was using Apache as a Web aan> sever. How can I fix this? I would not recommend running Apache as a service on XP if it's just your development machine and you like doing other things on this PC like playing games, etc :) Uninstall Apache. Get the latest 1.3 build of it, install it and pick to choose all the settings yourself. Fill the basics in (host name, etc) but do NOT set it to run as a service. Complete the installation. aan> 2nd issue. I downloaded and extracted PHP 5.0.4-Win 32. Although aan> I read the installation instructions, I have no clue how to aan> install it. There are several files and I don't know which to aan> execute to install PHP. Or which file (if any) to configure. "Install" PHP 4 and 5 --------------------- Grab the ZIP versions of PHP 4 and PHP 5 - do NOT get the "installers", they're not worth the time and will only serve to confuse you as to what has happened on your PC. Create a local folder, perhaps something like: D:\dev Unzip PHP4 and 5 into this folder, so you have: D:\dev\php-4.3.11 D:\dev\php-5.0.4 Edit the PHP INI files ---------------------- Go into each folder and find the php.ini-dist file. Take a copy of it and call it php4.ini. Do the same for php5.ini Open up these files into Notepad. You can leave most of the settings as they are, but find this one extension_dir and change it: extension_dir = "D:\dev\php-4.3.11\extensions" Do the same for the php5.ini (obviously the path will be different) Also decide which extensions you want enabled. For example you may want to un-comment ;extension=php_gd2.dll to enable GD graphics support. Just remove the ; For the PHP5 ini file you need to un-comment the php_mysqli.dll extension if you want to use the new MySQLi commands (recommended). Copy to the Windows directory ----------------------------- Save both of your ini files. Copy them both to the C:\Windows directory. Now copy these files into C:\Windows as well: php4ts.dll (from the PHP4 folder) php5ts.dll (from the PHP5 folder) You should now have 4 PHP files in your Windows folder. Don't run anything yet - it still won't work, we're getting there... Configure Apache ---------------- Go into C:\Program Files\Apache Group\Apache\conf Make a copy the httpd.conf file and call it httpd_php4.conf Make another copy, call it httpd_php5.conf Open up the httpd_php4.conf in Notepad. Find the LoadModule section and add this to the bottom of the list: LoadModule php4_module "D:/dev/php-4.3.11/sapi/php4apache.dll" Scroll down to the AddModule section and add this to the bottom: AddModule mod_php4.c Now scroll to the very bottom of this file and before the <VirtualHost> block starts, add this: AddType application/x-httpd-php .php <IfModule mod_mime.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule> Locate the "DirectoryIndex" value. It will have index.html, add index.php to it: DirectoryIndex index.html index.php Finally make sure that NameVirtualHost is NOT commented and looks like this: NameVirtualHost * Add this line under it: Include "conf/sites.conf" Save your file. Repeat for PHP 5 ---------------- Do ALL of the above, but this time do it to the httpd_php5.conf file. You will need to use different LoadModule and AddModule lines, they are: LoadModule php5_module "D:/dev/php-5.0.4/php5apache.dll" AddModule mod_php5.c Everything else is the same however. Save this file. Set Apache to handle local web sites ------------------------------------ To set Apache up to handle different web sites create a blank file in the conf folder called sites.conf - open it up into Notepad. Add an entry like so: <VirtualHost *:80> ServerName bgs.dev DocumentRoot D:\usr\home\bgs\public_html </VirtualHost> ServerName is the domain name you wish to type in to access this site locally. Do NOT use proper domain names! But rather if you are working on a site called "phprocks.com" then put the ServerName as "phprocks.dev" Change the DocumentRoot to point to a location on your PC where your web files FOR THAT SITE live. This can be anywhere. Save this file (make sure it is called sites.conf and not sites.conf.txt) Nearly there! ------------- Go into this folder (on XP): C:\WINDOWS\system32\drivers\etc Open the file called hosts into Notepad. Add 1 line to it, at the bottom: 127.0.0.1 phprocks.dev (change the domain to reflect whatever you added tot he ServerName above) Save this file. Last step: ---------- Go into your D:\dev folder. Create a blank text file called go-php4.bat. Edit it in Notepad, add this: @copy /Y "C:\Program Files\Apache Group\Apache\conf\httpd_php4.conf" "C:\Program Files\Apache Group\Apache\conf\httpd.conf" @copy /Y "C:\WINDOWS\php4.ini" "C:\WINDOWS\php.ini" @start "Apache" "C:\Program Files\Apache Group\Apache\Apache.exe" -w Save the file. Create another called go-php5.bat, add this: @copy /Y "C:\Program Files\Apache Group\Apache\conf\httpd_php5.conf" "C:\Program Files\Apache Group\Apache\conf\httpd.conf" @copy /Y "C:\WINDOWS\php5.ini" "C:\WINDOWS\php.ini" @start "Apache" "C:\Program Files\Apache Group\Apache\Apache.exe" -w Save it. In the text above make 100% sure that the paths are correct. For example if your Windows directory is called something else, change it in the batch files above. Test it! -------- You may wish to create a Desktop short-cut to each batch file and just rename them PHP4 and PHP5. Now double-click one. A console window should open and if you haven't done anything wrong ;) it will say "Apache/1.3.33 (Win32) PHP/5.0.4 running..." Open up a web browser and go to: http://phprocks.dev Your site will now appear. To close down Apache just bring up the console window and press CTRL-C (give it a few seconds, it does a clean shut-down). To swap to PHP4 hit the PHP4 shortcut icon instead. Add New Sites ------------- To add a new local web site simply edit the sites.conf file and the hosts file. Make sure they both match-up re: the domain name you use. You need to restart Apache each time you edit the sites.conf file (but NOT if all you do is edit the hosts file). To install a new version of PHP ------------------------------- Download it. Unzip it into a new folder D:\dev\php-5.0.5, copy the ini file and php5ts.dll files out following the steps above and voila.. you've just upgraded to the latest version without breaking a sweat. I know this all sounds like a lot of work, but you only need do it once and it's really quite easy. When finished you'll have a fully working local web server with a switchable PHP4/5 installation that will work just like a real web server does, only with "fake" domain names. I've used this method for years now - infact my scripts will detect if they're running on a .dev domain name and if they are they know to load up require files from my PCs path rather than that of the live web server. Having Apache run in a console window for development can be really useful and you simply don't need the overhead of it sat there running as a service all the time IMHO. You can install MySQL onto your PC and both PHP4 and 5 will use it quite happily. Mail me if you get stuck anywhere. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php