FAQ Database Discussion Community

PHP extension not built with same debug and thread safe as PHP

I built a number of custom PHP extensions under windows 8-10 years ago. I made the move to Ubuntu Linux for all of my web stuff some years ago and find I need to create another custom extension. I'll be doing the development under Ubuntu this time. I've created a...

Where is PHP's sybase_query Implemented?

I want to look at the implementation of sybase_query (http://php.net/manual/en/function.sybase-query.php) in PHP. How can I do that? I went here https://github.com/php/php-src, and searched for sybase_query, but nothing came up. Can you help me find the source to the sybase extension?

PHP 7 return dynamic alloc zval right way

what is actually the right way to return a dynamic allocated zval from a c function, and register it's automatic dtor? zval * php_test_fcn() { zval * t; t = ecalloc(sizeof(zval), 1); ZVAL_LONG(t, 1); return t; } And on the other side I call: zval **params = NULL; int arg_num=5;...

Installing Drupal - missing extension 'gd'

I'm attempting to install Drupal on an Windows / Apache / PHP box. When running the install script 'install.php' I'm told that the extension gd is not installed. My PHP ini file has it enabled: ... ;extension=php_curl.dll ;extension=php_fileinfo.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gmp.dll ... I have restarted the server. Looking inside the...

Symfony ZipArchive PHP Extension Class Not Found

I tried this code var_dump(class_exists('ZipArchive')); $zip = new ZipArchive(); well, the output is like this. bool(true) Fatal error: Class 'MyProject\ProjectBundle\Controller\ZipArchive' not found in \path\to\my\Controller.php on line 83 Anyone can help me how to solve this? I have installed php-pear php5-dev libcurl3-openssl-dev libevent-dev pecl-http all i need have been installed and...

Priority between spl_autoload_register and extension's function?

I use composer to manage my dependencies and class loading. This tool uses spl_autoload_register function. I would like to use a PHP's extension that provides some classes with same definition (name, namespacing, functionnalities) than others classes defined throught composer. Which class will PHP load? The extension's one, or the autoload's...

How to resolve this duplicate name error?

I want to create a native primitive data type extension, which can be good for strong typing. I have first defined an interface called ObjectInterface, and then a class called Object. Obviously, Object implements ObjectInterface, and I have this following code: /* {{{ scalarclass_functions[] * * Every user visible function...

Can a PHP extension be used to make calls to a C++ DLL?

I have C++ library that I would like to use to create a PHP extension. I don't have anything besides the compiled DLL file. I would just like to know if this is possible or does it need to be a C library?...

Install imap extension for php 5.3.3-7+squeeze17

Server has debian wheezy os installed. Php version is php5.3: [email protected]:~# php -v PHP 5.3.3-7+squeeze17 with Suhosin-Patch (cli) (built: Aug 23 2013 15:06:16) I try to install imap extension via apt-get and the result is: [email protected]:~# apt-get install php5-imap=5.3.3-7+squeeze17 Reading package lists... Done Building dependency tree Reading state information... Done...

Can' get PHP SOAP enabled

I think I have installed SOAP using: yum install php-soap However, when I use the following command: php -i | grep -i soap I get this error message: PHP Warning: PHP Start-up: Unable to load dynamic library '/usr/local/lib/php/extensions/php_soap.dll' - /usr/local/lib/php/extensions/php_soap.dll: cannot open shared object file: No such file or directory...

How to clone an object from PHP extension

I am trying to implement the prototype design pattern in my extension. How can I clone an object from an zval*. Is there a zend function equivalent to the userland clone operator? Update I wrote the following function for cloning an object. Not sure if there is a better way....

Use a PHP file pointer resource in C extension

I started developing my own little extension for PHP. But I'm struggling now with the resource types. Basically I like to use a file pointer passed as parameter to my own function. So let's say the following PHP code is the end result: <?php $fp = fopen('file.txt', 'w'); my_ext_function($fp); Now...

Return same array (zval) as passed in to a function

I tried to create a new function in my extension which takes an array as parameter adds an entry to that same instance of the array and returns that instance again. So this is the code so far: PHP_FUNCTION(make_array) { // array_init(return_value); // Also Tried to transform default NULL to...