When Windows is Needed

When Windows is Needed

Scenarios do crop up when you will simply have to use Windows. The most classic example is for the installation of a closed system onto a large company's IT infrastructure, which is already Windows based, and there is a resolute refusal to install a UNIX server.

With some adaptation, the examples in this book will all still work just fine. The following pointers may help you transfer your PHP from UNIX to Windows.

Changing Paths

Don't forget that paths on Windows look very different from paths on UNIX. References to paths such as /data/res/1230.jpg on disk will need to be changed to a Windows equivalent, such as C:\data\res\1230.jpg.

PHP is kind and allows you to keep the slashes oblique (/). If you avoid drive letters by using relative paths, you may be able to keep your application more portable.

Weird Differences

Some differences between PHP on UNIX and Windows are truly bizarre. One notable example is that in Windows you cannot use a class named Variant, whereas in UNIX this is perfectly allowable. Other such differences must surely exist. There is not a lot you can do to avoid them given their officially undocumented nature, however; when faced with a bizarre, head-scratching problem, go ahead and hit Google to see whether others have encountered the same difficulty.

External Libraries

Because Windows does not come with a built-in and highly pervasive C/C++ compiler in the same way UNIX does, PHP does not require a myriad of external libraries to work under Windows. Instead, PHP supplies with its Windows installations a huge set of precompiled DLLs for the various extensions discussed in this appendix libxml, libxslt, and so forth.

To enable such extensions, copy the relevant DLLs into both your PHP directory (such as C:\PHP) and your windows\system32 directory, and restart your Web server. You should find that the relevant functionality becomes available to PHP right away.

Using PEAR

Using the PEAR repository to install library packages in Windows is a little different from how it is accomplished under UNIX.

Before you can use PEAR, you need to set it up using the following bundled script:

   C:\php\PEAR>..\php go-pear.php    Welcome to go-pear!    Go-pear will install the 'pear' command and all the files needed by    it. This command is your tool for PEAR installation and maintenance. 

This script will ask you various questions about proxy servers and so forth, but will create a single pear command as a batch file, which you can then use in exactly the same manner as its UNIX counterpart.

Professional PHP5 (Programmer to Programmer Series)
Professional PHP5 (Programmer to Programmer Series)
Year: 2003
Pages: 182

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net