![]() Join Up! 96824 members and counting! |
|
|||
Installing PHP under XitamiBy Jayesh JainIntroductionIf you are a great fan of PHP, you might have installed PHP on an Apache server in a Linux environment. But most of the people will develop and test their code on a Windows machine till they move their work on a production machine. In this article I am going to step you through installing PHP under Xitami in Windows environment.
What is XitamiXitami is a small, fast, and powerful multiplatform Open Source web server which runs on all UNIX platforms, OS/2, OpenVMS, Windows 3.x, Windows 95, and Windows NT. Being Open Source, many of its features have been added by users. Also it is written in portable and easy-to-read ANSI C. Installing XitamiBuilding Xitami Web Server: To build the Xitami Web Server you need to download Xitami source kit for your system, on Unix you shall need an ANSI C compiler; for Windows you need MSVC or Borland C, on OS/2 you need the free EMX tools. The best platform for installing Xitami is Linux as it is fast and stable, but in this tutorial we shall concentrate on installing Xitami under Windows. Using Xitami Web Server Install Package: If you do not want to take the trouble of downloading the source file and building it you can download the Install Package from http://www.xitami.com/download.htm depending upon the operating system you have. I have used Production release 2.4d9 in this tutorial so I downloaded bw3224d9.exe, once the download is complete run bw3224d9.exe to start the installation. Installation for Xitami is pretty easy and is self-explanatory, but make sure you read all the screens as you go through the installation, I shall explain few important screen below. ![]() When the setup prompts you to choose Admin Password enter your username and password (in this tutorial we shall use test as username and test as password) Note: If you do not enter the username and password the browser-based administration shall be disabled. Keep Clicking next till your installation is completed, we shall assume that your installation was a smooth ride and you had no problem whatsoever in the whole process. Testing Xitami Installation:If you have not selected to run Xitami automatically after the installation during your installation process, you might have to run it manually to do this please click Start-Program-Internet Tools-Xitami Web Server - Windows. Please note a little green Icon in your system tray, which shall tell you that Xitami is running now, double click that icon to open the Xitami Web Server Properties which shall tell you the host name and other information. ![]() Open your favorite browser, in the Address area type the hostname from the Xitami Web Server Properties to see if Xitami is working fine. Let me show you a sample output on my machine.
Note: You can also use http://localhost/ or http://127.0.0.1/ in the browser Address. If you see the Welcome to Xitami screen on your browser, Eureka! we have done it. Also notice the Xitami Web Server Icon in the system tray turning yellow to indicate web server was serving file(s) which shall turn green again the moment web server is idle. Also notice that the Xitami Web Server Properties window shall also show you the IP address, Connections Kb transferred and some more information. Go fetch yourself lemonade and pat yourself on your back we have done it. Uninstalling XitamiYou can uninstall Xitami by selecting the 'Add/Remove Programs' option in the control panel. Xitami maintains various items in the Windows registry, which uninstall script, shall remove. Note: You can suspend and start your web server from the Xitami Web Server Properties Window. Configuring XitamiMost of the time Xitami will run straight out of the box with no configuration, but few of the advanced users may want to configure with respect to security, CGI, logging, etc. The entire configuration for Xitami is stored in the file xitami.cfg, which will be present in the folder where Xitami is installed. Web-Based Administration (WBA) Interface To go to the WBA please enter http://localhost/admin in the URL in the browser, you will have to enter the username and password you entered when you installed the Xitami Web Server. Once you enter the valid username and password you shall be provided with the administrator options as shown below.
Installing PHPDownload Windows binary for the latest version of PHP. Once you've downloaded it, unzip it into a C:\, 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 Xitami, 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 Xitami for PHPPoint your browser to Xitami admin console http://localhost/admin and click on Configuration. Click on Filters, and put the extension which PHP should parse (i.e. .php) into the field File extensions (.xxx). In Filter command or script put the path and name of your php executable i.e. c:\php\php.exe. Press the Save icon and restart the server to reflect changes. Alternately you can add the following lines to default.cfg, which will be present in the folder where Xitami is installed and restart the server to reflect changes. [Mime] php=application/x-httpd-php [Filter] .php=c:\php\php.exe Testing PHP under XitamiOpen your favorite text editor and create a text file and type the following in it:
Save this file as test.php in C:\Xitami\webpages (your default Xitami Web Root Folder) 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. 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 Xitami does not recognizes PHP files, please make sure you have followed the instructions properly. Finally
Few more things you might want to know about Xitami, in the xitami.cfg change the following setting
[Security] admin=0 To change the http port: [Server] portbase=5080
Xitami default web root folder is a subdirectory called webpages under the Xitami's installation folder. Conclusion
I hope this article gave you a quick overview on how simple it is to install Xitami 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. --- About the AuthorJayesh is an working as a consultant in Auckland, New Zealand. He has several years of n-Tier development experience and is currently working with Visual Basic.NET and PHP to develop interactive client solutions. |