php-extension

How to start writing a PHP5 extension in C++

I'm writing a PHP5 extension, and while I could write it in C, it would be easier to use C++ and take advantage of the STL and Boost. Trouble is, the tutorials I've seen only deal with C, and I'm looking for a basic example which uses C++ Here's what I've tried so far: config.m4 [ --enable-hello Enable Hello World support]) if tes...

Differences among the methods of loading an extension in PHP

extension="ext.so" zend_extension="/usr/lib/php4/ext.so" zend_extension_ts="/usr/lib/php4/ext.so" What are the differences? ...

PHP extension on a Mac

I wrote a PHP extension, and I'm trying to get it running on Mac's Apache server. It runs fine via the command line, for example: $ php -r 'dl("mylib.dylib"); I also tried building Apache from source, and it works perfectly when I run that (I set it up to use the same PHP as Mac's built-in Apache, too, so no difference there). How...

In need to program an algorithem to be very fast, should I do it as php extension, or some otherway?

Most of my application is written in PHP ((Front and Back ends). There is a part that works too slowly and I will need to rewrite it, probably not in PHP. What will give me the following: 1. Most speed 2. Fastest development 3. Easily maintained. I have in my mind to rewrite this piece of code in CPP as a PHP extension, but may be I a...

Passing a variable by reference into a PHP extension

I'm writing a PHP extension that takes a reference to a value and alters it. Example PHP: $someVal = "input value"; TestPassRef($someVal); // value now changed What's the right approach? ...

How do I check for an unmangled C++ symbol when building a PHP extension?

I have a PHP module written in C++, which relies on a C++ library (Boost Date_Time) being installed. Currently, in my config.m4 file I'm checking for the library as follows: LIBNAME=boost_date_time LIBSYMBOL=_ZN5boost9gregorian9bad_monthD0Ev PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,, [ AC_MSG_ERROR([lib $LIBNAME not found. T...

How do I find out what PHP library module is required for a function?

I wonder, how am I supposed to know which libraries I should include in my php.ini file when using a certain function. For instance, I just looked up pg_connect(), and I wonder which libraries I should include. I can think of php_pgsql.dll, but that's about it. Do I need others? I wouldn't know, since that doesn't seem to be documented...

php extension on windows xp

I've installed php on my xp, but failed to add an extension to mysql Here is what I did in php.ini: [PHP_MYSQL] extension=php_mysql.dll and there is such a file in ext/ but when I look into phpinfo(), only to find that mysql extension is still not added. What have I did wrongly? ...

Compiling my own PHP extension on Windows with Visual Studio 2008

I wrote a PHP extension and it could be compiled and run under linux successfully. But on windows, I met some problems. I did the compiling on windows according to http://blog.slickedit.com/?p=128 with PHP source version 5.2.10, and after the compiling it generated the dll file. But when I tried to use the dll file, it reported me the m...

Returning unsigned long long from an extension function in PHP

If i need to return a long i simply use the RETURN_LONG macro. But what do i do if i need to return an unsigned long long. If i use this macro the data gets corrupted... ...

PHP extensions not found

PHP keeps failing and telling me that its not finding the /ext/php_mssql.dll for some reason. Obviously, I checked the folder and it is very much there. I'm not sure why it is failing. Any suggestions? EDIT: I put the ntwdblib.dll into my php directory and the error that was giving went from "bad gateway. the specified cgi application ...

How do I compile an extension for PHP 5.3 for windows as a DLL?

I'm currently rewriting a PHP Extension that was originally written for PHP 4.2.2. My issue is having the build/compile process generate a DLL instead of compiling the extension into the PHP core. The environment is windows server 2003. I'm using Visual Studio 2008. I used the EXT_SKEL script to generate the framework, and I can succ...

Documenting a PHP extension with PHPdoc

I've written a PHP extension in C, and I want to create PHPdoc documentation so that my users will get inline docs in their PHP IDE (in this case, Netbeans) when calling my extension. Ideally I'd like to do this by embedding the PHPdocs in the C code, to keep implementation and documentation together. Assuming it's possible to embed PH...

Code completion for PHP extensions in Zend Studio?

After having installed the HTTP extension from PECL, I expected Zend Studio 6 to recognize the provided HTTP* classes and for code completion to be made available. This is not the case, however. How do I get Zend Studio to recognize classes provided by PHP extensions? Specifcally, I want to be able to use code competition on these classe...

How do I add an array as an Object Property to a class declared within a PHP extension?

I want my PHP extension to declare a class equivalent to the following PHP: class MyClass { public $MyMemberArray; __construct() { $this->MyMemberArray = array(); } } I'm following the examples in "Advanced PHP Programming" and "Extending and Embedding PHP" and I'm able to declare a class that has integer prop...

Extending PHP with C++?

I have a performance intensive routine that is written in PHP that I'd like to port to C++ for a performance increase. Is there any way to write a plugin or extension or something using C++ and interface with it from PHP? WITHOUT manually editing the actual PHP source? ...

Reading php.ini using zend for PHP extension (not PHP language)

I am trying to read some settings from php.ini using zend. The API that I am using is long zend_ini_long(char *name, uint name_length, int orig) But it always returns 0. I have double checked the name and also made sure that the value I am specifying in php.ini is greater then 0. Is there anything I am missing? ...

PHP intl extension

Someone experienced with intl extension for PHP under Windows XP please help me find the php_intl.dll and suggest how to install. Thanks! ...

Unable to create JVM using jni_CreateJavaVM API in Fedora 8

I have created a PHP extension (written in C). I am using JNI to make java calls. I use jni_CreateJavaVM to create JVM. This works fine in: IIS (windows) Apache (windows) PHP CLI (Fedora 8) But when I try to load the same extension from Apache (in Fedore 8), the create jni_ CreateJavaVM return JNI _ERROR. I call jni _CreateJavaVM fr...

Linking a PHP Extension Written in C

Edit: Revising My Question When building an external PHP module in C, how do I link shared objects? ...