Getting it to work

The PHP SDL homepage is at - 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_*.


Next chapter: First steps >>

Previous chapter: Getting graphical

Jump to:


Home: Table of Contents

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar