21.4.4 Getting it to workThis is NOT the latest copy of this book; click here for the latest version.
The PHP SDL homepage is at http://sourceforge.net/projects/phpsdl - go there and download the Windows binary (named "phpsdl-bin-win32") if you are on Windows, or the Linux binary if you are on Linux. You can also compile it yourself on Linux if you really want to.
Installation on Windows can be tricky because of the fact that the binary is a complete packaged PHP installation stripped of everything not required by PHP SDL. That is, it comes with php.exe and other files, and this may well clash with your existing installation. The package comes with an example application called runstars.bat, which executes the bundled php.exe and gets it to parse stars.php. If you run this and you get a string of error messages like the one below , it means you have a conflict on your machine that needs to be cleared up.

The easiest way to do this is to go to your Windows directory (probably c:\windows) and rename php5ts.dll to _php5ts.dll and php.ini to _php.ini. You may also need to do the same in your Windows System32 directory (probably c:\windows\system32) just to make sure. Now when you try again, everything should work smoothly. The stars.php file is not very photogenic, but here's a screenshot anyway - it may look like inky blackness, but on your screen you should be able to see spinning stars!

Installation on Unix is best done compiling the application from source, and the package comes with complete instructions on how to do this in the file "README". Note that the Unix version is much newer than the Windows version and has more functionality - the code discussed here is targeted at the Windows release, and will not use any of the more advanced features found in the Unix version. Although the majority of the code in the SDL examples are written to work on Windows, they should work with just a few minor changes under Unix - if you compile it into your php executable, for example, you will not need to dl() the SDL extension. The only real difference between the two is that the Windows release uses phpSDL_* for function names, whereas the "php" is dropped in the Unix version, so it is just SDL_*.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|