I am trying to code PHP extensions in C++. I am referring 'Embedding and Extending PHP' by Sara Golemon.
The book has several small snippets as such,
void describe_zval(zval *foo)
{
if (Z_TYPE_P(foo) == IS_NULL) {
php_printf("The variable is NULL");
} else {
php_printf("The variable is of type %d",
Z_TYPE_P(foo));
}
}
I have saved the above code in .cpp
The struct zval etc is defined in files in /usr/local/src/php-5.4.11/ and its sub -directories. That is the installation directory of PHP on my PC [Fedora]. So I tried
#include <zend.h>
and used -I /usr/local/src/php-5.4.11/ while compiling. But zend.h seems to require some other file present in /usr/local/src/php-5.4.11/ directory. If i #include that it requires some others and so on... Basically a chain of .h is being called which resides in several different sub directories of /usr/local/src/php-5.4.11/ . Its not possible for me to #include all of them. Is there any existing library for this? using Zend variables for PHP extension development using Cpp
Is there a better way to do this? I mean is there a better way to practise those small snippets before i jump into the whole extension development.
phpizewill be useful?