Menu
  • HOME
  • TAGS

Priority between spl_autoload_register and extension's function?

php,autoload,php-extension

PHP will use the extension's one. This is because autoloading will only happen if you are attempting to access a class which does not already exist. Extension functions and classes will exist after PHP's startup meaning before the code starts to run.

Symfony ZipArchive PHP Extension Class Not Found

php,symfony2,php-extension,ziparchive

After installation is done and check your ZipArchive class is exist with this code var_dump(class_exists('ZipArchive')); if it returns true then you just add use ZipArchive; put it after your namespace and then put this code $zip = new ZipArchive(); on where you are want to put....

PHP 7 return dynamic alloc zval right way

php,zend-framework,php-extension,php-7

ok answered it to myself :D problem was the **pointer. Final code - did it: zval * params = NULL; zval * t; int i = 0; int arg_num = lua_gettop(L); params = safe_emalloc(sizeof(zval), arg_num, 0); //if(arg_num >= 100) return 0; for (i=0; i<arg_num; i++) { //params[i]=ecalloc(1, sizeof(zval)); //params[i] =...

What is the difference between tzdata database and timezonedb?

php,timezone,php-extension

One of the databases (tzdata) ships with PHP, this is used by default. A later version of the db can to be installed separately on the system via PECL. Pecl timezonedb extension indicates there is an embedded db by default. This extension is a drop-in replacement for the builtin timezone...

Can' get PHP SOAP enabled

php,soap,php-extension

If you check this answer you might find your clue how-to-enable-soap-on-centos You should point to some soap.so library. DLLs are usually on windows. Check your libraries path /usr/local/lib/php/extensions and see if any soap.so library is to be found there...

Are PHP extensions just “shell cases” for real libraries?

php,shell,php-extension

No, absolutely not. Most PHP extensions interface directly with a C library, and imagick is no exception. The shoddiness of the imagick extension is entirely the fault of the ImageMagick library itself....

Use a PHP file pointer resource in C extension

php,c,php-extension

The PHP_STREAM_TO_ZVAL can't be used directly because it's declared inside the implementation of ext/standard/file.c; you need to use this instead: php_stream_from_zval(stream, &res); You can cast the stream to what you need using php_stream_cast(): { FILE *f; if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&f, REPORT_ERRORS)) { RETURN_FALSE; } /* do what you...

Reading Excel xlsx files in PHP without ZipArchive class or PHP extension php_zip enabled

php,excel,nginx,zip,php-extension

Since version 1.8.0, PHPExcel has offered an alternative built-in Zip handler that can be enabled by setting PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP); before loading any files that are zip-based archives such as xlsx or ods This is slower and uses more memory than PHP's own ZipArchive extension, but provides an alternative if ZipArchive isn't...

Installing Phalcon PHP Devtools: “ERROR: Phalcon extension isn't installed …” though the module is installed

php,installation,php-extension,phalcon,devtools

The answer to both questions (1. Why do I get an error? and 2. Why php --modules doesn't show the module, though phpinfo() (in browser) does?) is the same: I enabled the module for FPM, but didn't do this for the CLI. $ ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/cli/conf.d/20-phalcon.ini Now it works!...

php_printer.dll installation doesn't work

php,dll,printing,php-extension

I found the solution. you have to use the same VC version of your apache pack

How to clone an object from PHP extension

c,clone,php-extension

Generic clone method... zend_object_value val = zend_objects_clone_obj(zval *zobject TSRMLS_DC); ...

debugger for developpement PHP extention's [closed]

php,c,debugging,php-extension,zend-studio

I use gdb to debug PHP extension. You can set breakpoint by function name, gdb will show you something like this because PHP extensions are loaded by dlopen. Press y, then run: Function "foo" not defined. Make breakpoint pending on future shared library load? (y or [n]) ...

Changing php.ini entries using zend API

c,php-extension,php-internals

this is my code(c++) for change php.ini in extension. it will be ignore event on_modify. may be it can help you. bool hack_ini_set (std::string _name, std::string _val) { zend_ini_entry *ini_entry; char *duplicate; zend_bool modifiable; zend_bool modified; char* name = const_cast<char*> (_name.c_str()); uint name_length = strlen(name)+1; char* new_value= const_cast<char*> (_val.c_str()); uint...

PHP Extension for C is failing to find function in C Library

php,c,linux,php-extension

The issue was with an incorrectly configured config.m4 file. I added the following that I modified from examples I found to get it to work: if test "$PHP_HELLO" != "no"; then SEARCH_PATH="/usr/local /usr" # you might want to change this SEARCH_FOR="/include/netcdf.h" # you most likely want to change this if...

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

php,php-extension

Its hard to say what exactly was going wrong, I can only say that the extension was build using a different config than the php version. I will describe some reproducible steps how to compile a most basic extension with debug symbols within the PHP source folder. The extension contains...

Issue Running Imagick module (PHP 5.4.13, WAMP server)

php,wamp,imagick,php-extension

After a few days of frustration and many, many cases of trial and error I have finally come upon a solution. All versions of ImageMagick later than 6.6.4.0 under windows are compiled with vc10 instead of vc9. Source: ByteHash I uninstalled ImageMagick 6.8.9-0 Q16 x86, and re-installed version 6.6.4-0. Doing...

SNMP extension crashes my php 5.6.7 and 5.6.10 (windows 8)

php-extension,php-5.6,snmp-extension

I actually just found a comment in here that helped me solve the issue. Basically in c:\usr\snmp\persist\mib_indexes\ directory I found two files named 0 and 1. If you remove them SNMP extension works fine....

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

php,c,php-extension

Using return_value directly as part of a ZPP argument is typically not done (actually, never); it's commonly done by introducing a regular zval * container and then RETURN_ZVAL or RETVAL_ZVAL macro is used: PHP_FUNCTION(make_array) { zval *arr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arr) == FAILURE) { return; } add_assoc_long(arr, "answer", 42);...

How to access current php file in php extension (written in c)?

php,c,php-extension

finally i found the solution. to access __ FILE __ in your php extension, you can use like this: char *file_name = zend_get_executed_filename(); ...

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

php,c++,php-extension

Yes, You can build extension using C++ libraries. There is a very good example describing the process here : http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/...

yum install php-idn not working on centos 6.6

php,centos6,php-extension

Uninstall epel and do a yum clean all then reinstall the latest epel and your package. wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm There may also be conflicts with epel and rpmforge. They CAN both be used together with yum priorities or protectbase. See: http://wiki.centos.org/PackageManagement/Yum/ProtectBase...

How to resolve this duplicate name error?

php,c,php-extension

You have to use those two zend_function_entries with the INIT_CLASS_ENTRY macro as method entries for the respective class entry and register your class in MINIT. The zend_function_entry for the module struct can only have functions, not methods....

Mongo php extension after Heroku update (composer)

php,mongodb,heroku,composer-php,php-extension

The mongo extension is now supported: https://devcenter.heroku.com/changelog-items/467 - no need for custom buildpacks.

PHP Extensions - RETURN_STRING

php,c++,string,valgrind,php-extension

Although it's not stated in the documentation for the RETURN_STRING macro (which seems like an omission: it should definitely state lifetime requirements) it would appear that the macro expands to more than one line. Say, for example: RETURN_STRING(myclass->test().c_str(), 1); becomes: const char* arg = myclass->test().c_str(); someCode(); someMoreCode(); finalCode(arg); arg is...

Where is PHP's sybase_query Implemented?

php,sybase,php-extension

The source code can be found here on GitHub. This is the maintainer's fork.

Installing Drupal - missing extension 'gd'

php,drupal,drupal-7,php-extension

Turned out to be a 'read the manual' moment. I hadn't set the default extension directory via: extension_dir = C:\php\ext as I assumed it would be relative within the downloaded installation. I eventually discovered this by reading the apache logs....

Install imap extension for php 5.3.3-7+squeeze17

php,debian,imap,php-extension,apt-get

I solved the issue with calling external python script, which uses imaplib (http://pymotw.com/2/imaplib/). Example of calling python from php: <? exec("python <ABSOLUTE_PATH_TO_SCRIPT>.py " . escapeshellarg($arg1)); ...