Introduction
Your production machine might have PHP installed on an Apache server in a Linux environment, but most of the people (like me) will develop and test their code on a Windows machine before they move their work on to the production machine.
Working on this assumption, in this article I am going to step you through the installation of PHP interpreter under BadBlueWeb Server in windows environment.
In the article we shall use BadBlue Personal Edition v2.14 and PHP
4.3.0 on a Windows 98 Machine.
Welcome Aboard sit back and enjoy!
What is BadBlue
BadBlue is a tiny, full-blown web server, which runs PHP, Perl and other
CGI/ISAPI extensions. BadBlue is designed for fast configuration. And it's so
tiny, you can carry it around on a floppy disk!
Below are some features of BadBlue Personal Edition:
- Smaller Download/ Simple installation Procedure.
- No spyware or adware software installed.
- Supports searching, downloading and uploading, securely.
- Password-protects your files and controls access to files by user name.
- Searches other computers for their shared files (peer-to-peer).
- Supports folders, virtual directories, directory browsing and more.
- Scheduling.
Installing BadBlue
Download the BadBlue installation program from
http://www.badblue.com/down.htm
for the operating system you plan to install it on.
Installation for BadBlue is pretty easy and is self-explanatory, but make
sure you read all the screens as you go through the installation.
Run the installation program, Select the type of install (I would recommend 'Normal'), click next, select the directory to install BadBlue in
(default is C:\Program Files\BadBlue\PE). Click next to extract all the
necessary file(s), which shall also complete your installation. We shall
assume that your installation was a smooth ride and you had no problem
whatsoever in the whole process, which is usually the case.
Testing BadBlue Installation:
BadBlue should run automatically if you selected yes in the last step of
installation which asked 'Automatically start your web site each time you
login?', else start the program manually. Please note a little BadBlue Icon in
your system tray, which shall tell you that BadBlue is running, double
click that icon to open the BadBlue Server Window which can be used to change
the HTTP Port (default is 80). You can also stop and start your web server
from this screen.
Once you start the BadBlue server it should automatically open a browser
with the welcome screen. If not, open a browser, and in the address bar, type the
http://localhost/ or http://127.0.0.1/ (which is your local IP) to see if
BadBlue is installed and working fine. Let me show you a sample output on my
machine.
If you see the Welcome Screen in your browser, Eureka we have done it.
Go fetch yourself lemonade and pat yourself on your back!
Installing BadBlue as a Service
BadBlue can be installed as service on Windows Machine
For Windows95, 98 and ME run the following command:
"C:\Program Files\BadBlue\PE\badblue.exe" -install9xservice
To remove the service:
"C:\Program Files\BadBlue\PE\badblue.exe" -remove9xservice
For Windows NT and 2000:
"C:\Program Files\BadBlue\PE\badblue.exe" -installntservice
To remove the service:
"C:\Program Files\BadBlue\PE\badblue.exe" -removentservice
To stop BadBlue:
"C:\Program Files\BadBlue\PE\badblue.exe" -stop
Uninstalling BadBlue
Because BadBlue has a very tiny installer and to keep its size to a minimum
it does not add information to the Windows Control Panel and cannot be removed
from Add and Remove Programs menu. You can uninstall BadBlue by running
C:\Program Files\BadBlue\PE\uninstal.exe. Note: Your directory might be
different if you installed BadBlue in some other folder
Installing PHP Interpreter
Download the Windows binary for the latest version of PHP. Once you've
downloaded it, unzip it into a C:\ directory and rename the folder to "php".
Open the PHP.INI-DIST file from C:\PHP folder, locate the following
line:
;cgi.force_redirect = 1
We need to uncomment this line and change the setting to 0, as shown below,
to run PHP under BadBlue, do the necessary changes and save the file as
php.ini in your windows folder (C:\windows on my computer).
cgi.force_redirect = 0
Configuring BadBlue for PHP
Open your favorite browser, in the Address area type http://localhost/
to open the BadBlue welcome page, click on hyperlink 'Help' from the options
available below the BadBlue logo in the browser. You can also type in the
address type 'http://localhost/help.htm' to open that page. (let me show you a
snapshot of this screen).
In the help Screen look in the Developer support section and click on the
hyperlink PHP installation wizard which shall open the PHP Wizard - Step 1 of
3 window, click next to go to step 2 and enter the location of php.exe in this
screen eg: c:\php\php.exe
Click next to reach step 3 and click finish to complete the
configuration.
Manual Configuration instructions
If you would like to configure BadBlue for PHP manually, open the ext.ini
file (usually in the directory c:\program files\badblue\pe) and add the
following lines
[SERVICES]
extension1=php,c:\php\php.exe
extension2=php3,c:\php\php.exe
extension3=php4,c:\php\php.exe
Note: Make sure that the path to PHP.EXE is correct and don't forget to
save the file.
Restart the BadBlue server to reflect the changes.
Testing PHP under BadBlue
Open the browser, in the Address area type the http://localhost/ to open the BadBlue welcome page, click on hyperlink 'Help' from the options available below the BadBlue logo in the browser.
In the help Screen go to the Developer support section and click on the
hyperlink 'Test PHP support', which shall open the Test PHP Support window, if
PHP is correctly installed and configured, you should see today's date and
time displayed in that browser window. You can also type http://localhost/testphp.php in the address to open that test page.
Alternately you could open your favorite text editor and create a text file
and type the following in it.
<?php
phpinfo();
?>
phpinfo() is a PHP function which outputs a large amount of information
about the current state of PHP. This includes information about PHP
compilation options and extensions, the PHP version, server information and
environment, the PHP environment, OS version information, paths, master and
local values of configuration options, HTTP headers, and the PHP License.
Save this file as test.php in C:\Program Files\BadBlue\PE\ (your default
BadBlue Web Root Folder)
Open you browser and type http://localhost/test.php in the address bar,
click Go to see if you see output like the screen below to make sure PHP in
configured and running properly.
If the source code appears in the browser and not the output we are
expecting, then PHP has not been properly installed or BadBlue does not
recognizes PHP files, please make sure you have followed the instructions
properly.
Configuring Web Server
To change the Document Root Folder (default is the folder where BadBlue is
installed), open the ext.ini file in the BadBlue directory and add the
following lines.
[SERVICES]
DOCROOT=C:\myfolder\wwwroot
To change the default page (default is index.htm) use the following setting
in ext.ini
[SERVICES]
HOMEPAGE=index.php
Every time you start the server, the web server opens the browser window. To
turn this feature off use the following setting in ext.ini.
[CUSTOMIZE]
autobrowser=0
Every time you start the server, the web server opens the server window. To
minimize this window use the following setting in ext.ini.
[CUSTOMIZE]
autominimize=1
Note: Always make sure you restart the server to reflect the changes made
to ext.ini file.
Conclusion
I hope this article gave you a quick overview on how simple it is to
install BadBlue and to configure PHP under this web server. Also you must be
convinced that PHP is very versatile and works with any platform and web
server.