Phpmatsuri2011-clmandelbrot is a project mainly written in C and PHP, based on the View license.
This is a standalone PHP extension created using CodeGen_PECL 1.1.3
This is a PHP extension port of the OpenCL example program written in Objective-C. The original code and the Xcode project can be found at http://www.geocities.jp/parastyx/OpenCL/.
There are two ways to modify an extension created using CodeGen_PECL:
you can modify the generated code as with any other PHP extension
you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen
The 2nd approach may look a bit complicated but you have be aware that any manual changes to the generated code will be lost if you ever change the XML specs and re-run PECL-Gen. All changes done before have to be applied to the newly generated code again. Adding code snippets to the XML source itself on the other hand may be a bit more complicated but this way your custom code will always be in the generated code no matter how often you rerun CodeGen_PECL.
Before compile, create a symbolic link by the following command:
$ ln -s /System/Library/Frameworks/OpenCL.framework/OpenCL libOpenCL.dylib
To compile your new extension, you will have to execute the following steps:
The extension provides the VisualStudio V6 project file
clmandelbrot.dsp To compile the extension you open this file using VisualStudio, select the apropriate configuration for your installation (either "Release_TS" or "Debug_TS") and create "php_clmandelbrot.dll"
After successfull compilation you have to copy the newly created "clmandelbrot.dll" to the PHP extension directory (default: C:\PHP\extensions).
You can now load the extension using a php.ini directive
extension="clmandelbrot.[so|dll]"
or load it at runtime using the dl() function
dl("clmandelbrot.[so|dll]");
The extension should now be available, you can test this using the extension_loaded() function:
if (extension_loaded("clmandelbrot")) echo "clmandelbrot loaded :)"; else echo "something is wrong :(";
The extension will also add its own block to the output of phpinfo();