php-extension

Memory usage of current process in C

I need to get the memory usage of the current process in C. Can someone offer a code sample of how to do this on a Linux platform? I'm aware of the cat /proc/<your pid>/status method of getting memory usage, but I have no idea how to capture that in C. BTW, it's for a PHP extension I'm modifying (granted, I'm a C newbie). If there are ...

What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application?

What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application? The important features that comes to my mind are: under active maintenance A lot of documentation and examples. Probably endorsed by the Mysql people themselves. Robust scalable ...

How to export all functions inside PHP extension?

I opened php_sqlite.dll & php_sockets.dll using Depends.exe. I saw only 1 function in both: get_module How can I export all functions in extension to dll files when compiling the .dll? AFAIK, ZEND_FUNCTION is used to declare functions in the modules. Please kindly advise. Thank you very much! ...

PHP extension that uses memcached

I am thinking of writing a PHP extension library that will use the memcached library. It is trivial to simply link my library to the memcache shlib. However, I am not sure what will happen if my (extension library) user already uses memcache on his/her website. My questions are: Is it possible to have (possibly different versions) of...

Compile my own PHP extension on windows, but got LNK 2005 error

I am using VC 2008 express, and tried to compile my own PHP extension with that. Any idea about the following error? ------ Rebuild All started: Project: xsplit, Configuration: Debug Win32 ------ Deleting intermediate and output files for project 'xsplit', configuration 'Debug|Win32' Compiling... xsplit.cpp c:\x\php-5.3.1\zend\zend_exec...

php extension, how!!?

I need this library http://svn.arabeyes.org/viewvc/projects/itl/ports/php/. It is a php extension, and I want to know how I can use this. Do I need to compile this, and if so, how can I compile it? I've never compiled anything .. I need it to work for both Windows and Linux. ...

Compiling a PHP extention library on Ubuntu (Karmic Koala)

I compiled some PHP extention libs (in C/C++) a while back, on my XP platform. I have now moved the sources to my Ubuntu box, and want to build the libs for use on my Linux box. However, I have come accross a number of obstacles: I cant locate phpize (even after installing the php5dev package) I cant find ext_skel to generate the skel...

List used PHP modules in code base

I need to list all PHP extensions that's required by a given code base. What would be the best way to tackle this problem? My initial thought is to write a script that goes through all files and find all functions and compare them to a given extension/function database. Any other suggestions? Update: I already did some Bash script w...

PHP extension wrapper for C++

Hi guys, I am new in this area of writing extension for PHP, however I need to create a wrapper class for C++ to PHP. I am currently using PHP 5.2.13. I read this article http://devzone.zend.com/article/4486-Wrapping-C-Classes-in-a-PHP-Extension, a tutorial on how I could proceed to wrap C++ class to communicate with PHP Zend however it ...

Win32 PHP extension development

What are first steps creating a loadable DLL module extension for PHP to create native support for my own library on Windows? Would it require re-compiling PHP on windows? What are the tools needed? I don't want to have to use exec and the command line. ...

custom php function creation and install

I would like to know how to create a php function that can be installed in php just like the already built in functions like : rename copy The main point I would like to achieve is a simple php function that can be called from ANY php page on the whole host without needing to have a php function within the php page / needing an inc...

What is the most recommended resource to learn PHP extensions?

I need to learn how to develop PHP extensions. So, I assume I have to refresh my CPP skills (or is it C?). What IDE should I use (auto-completion, object browsers etc). I plan to develop on Ubuntu 32. Is there a good book or good website I can learn from? ...

Is it possible to run PHPUnit with a dynamically loaded extension library?

I have a suite of PHPUnit tests for my extension, and I want to run them as part of the extension's Hudson build process. So I want to run PHPUnit specifying the extension library to load at runtime, but I can't figure out how to do this. My directory structure is as follows: /myextension.c /otherextensionfiles.* /modules/myextension....

Call glutinit in a PHP extension

Hi guys, I am developing a php extension that require the use of opengl. I tried to initialize the library with glutinit; it works in CLI environment but when I tried on browser it doesn't seem to execute the code. The code is actually executed on the server side. It is part of a process to extract features from an image, and the serv...

How can I return an object into PHP userspace from my extension?

I have a C++ object, Graph, which contains a property named cat of type Category. I'm exposing the Graph object to PHP in an extension I'm writing in C++. As long as the Graph's methods return primitives like boolean or long, I can use the Zend RETURN_*() macros (e.g. RETURN_TRUE(); or RETURN_LONG(123);. But how can I make Graph->ge...

pgsql.so is not loaded in PHP

Hi, I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code. My question is that I can't seem to get the ...

How Do I Make a PHP Module with the Vala Programming Language?

This new language called Vala, which is said to be C#-like and supposedly easier than C++ or C, compiles down into C on Linux with the GCC compiler. Sounds great. Now I want to use it to make a PHP extension module so that slow PHP code can be made in Vala and imported into PHP as a function. How do I accomplish this in Vala? Is it eve...

Renaming Functions during runtime in PHP.

In PHP 5.3 is there a way to rename a function or "hook" a function. There is the rename_function() within "APD" which has been broken since ~2004. If you try and build it on PHP 5.3 you'll get this error: 'struct _zend_compiler_globals' has no member named 'extended_info' This is a really easy error to fix, just change this line: ...

How to return array of C++ objects from a PHP extension

I need to have my PHP extension return an array of objects, but I can't seem to figure out how to do this. I have a Graph object written in C++. Graph.getNodes() returns a std::map<int, Node*>. Here's the code I have currently: struct node_object { zend_object std; Node *node; }; zend_class_entry *node_ce; then PH...

creating PHP C/C++ extension modules using SWIG

I have written some C/C++ extension modules for PHP, using the 'old fashioned way' - i.e. by using the manual way (as described by Sarah Golemon in her book). This is too fiddly for me, and since I am lazy, and would like to automate as much as possible. Also, I have used SWIG now to generate extensions to Python, and I am getting to li...