So this is the case, I am trying to develop an php-extension for my customers. I use SWIG for generating the wrapper code and my main code is c++. After I create my extension successfully I load it in /ext and restart the web server for testing it. I've got the error which mentioned that the extension has been built with API 20090626 but the PHP server(in my case XAMPP) API is 20100525. I totally understand the error, so I open the Zend_modules.h header file in php source and change the API number from 20090626 to 20100525, then I build my extension with updated zend_modules.h header file and now I have no problem.
The question is, my customers are using different php servers with different APIs for sure, and I planed to give them a dll (my extension) which can be loaded easily without any struggles. But now I should give them a VS2010 solution with my main code (dll) dynamically loaded. I mean each user should first check the PHP API from his own server and change the Zend_modules.h header file, build the solution and then use the extension. I need a solution which make my extension totally independent to that API number.
I really appreciate any idea.
I totally understand the error, so I open the Zend_modules.h header file in php source and change the API number from 20090626 to 20100525
The fact that you're doing this tells me that you do not actually understand the error.
Modules are NOT compatible between different major versions of PHP -- the Zend API number is used to ensure that PHP does not inadvertently attempt to load a module that was built for a different version. The modifications that you're making to your PHP build tree are causing it to build modules that will not function correctly on any version at all.
If you need to build modules for multiple major versions of PHP, you need to run the builds using the corresponding version of PHP. You cannot mix and match, and you cannot build a single module that will work for multiple versions. (Nor should you advise your users to modify their PHP build to accept an incompatible module. That'll just make horrible things happen.)
The API versions for a few versions of PHP are listed below:
PHP 5.2: 20060613
PHP 5.3: 20090626
PHP 5.4: 20100525
PHP 5.5: 20120211
Related
I load an API into dll file from a software coding in C# to my web app in PHP.
I follow the install process with the extension everything seems ok
but my dll doesn't appear in my phpinfo().
Into my PHP ERROR LOG i've got this : PHP Warning: PHP Startup:Unable to load dynamic library
'c:/wamp64/bin/php/php5.6.25/ext/php_theapi.dll'
I would like to know how we check if the dll is compatible with PHP. And in Second time someone can post a method for get the entry point for the dll.
PS: I have IIS istalled and i am on MS server R8
Someone get a idea ?
I recently upgraded my Linux server from Apache 2.1 to 2.4 and PHP 5.2 to 5.3. Previously I was using pdf.so from PDFlib fine, but when I tried to install it, as downloaded from here,
http://www.pdflib.com/download/free-software/pdflib-lite-7/
PHP failed to load the module as it was compiled in for PHP 5.3. This install was done using the newest version of PDFlib that I could find, 9.0.2.
Anyone know whether this is possible? I've already got things coded in PHP for PDFlib and prefer not to use another library unless the commands are the same.
UPDATE
Has anyone successfully used PDF Lite with PHP 5.3?
You must compile it. Currently no build is available for PHP 5.3.
On the Download-Site, READ the info:
PDFlib Lite source code must be compiled to generate a usable library. PDFlib GmbH does not offer precompiled (binary) versions of PDFlib Lite.
If you have compile errors, check out the error logs - What say it? Yep, i think you need additional sources for compiling (mostly).
I am trying to install the following php extension. Microsoft Drivers for SQL Server for PHP.
I have tried both versions of the driver but both seem to mismatch the version of php i am running. I looked around and it appears I have to recompile the modules in order to match the php api version. But I don't have any idea how to do this.
Any ideas on how to make this work? Or maybe a simpler way to use PHP 5.4.7 to access SQL.
You can do it with some tricks, its not recommended but it will work fine and in my case, it has not crashed yet :)
Check your phpinfo() page for:
1-PHP extension API Number
2-Thread safe or non-thread safe version
3-(Windows) compiler version
1-For building your extension you need php.lib. It is in your PHP-server dev directory.
2-You need PHP header files for compiling your extension, after including PHP header files, go to PHP/Zend directory and open zend_modules.h file and change the #define ZEND_MODULE_API_NO 20060613to your PHP extension API number for example change it to #define ZEND_MODULE_API_NO 20090626.
3- If you use windows based servers the compiler version is important(VC8 - VC10), if your PHP was compiled with VC8, build the extension in VS2008 or use VC8 for building your project.
If you encounter any wired error just comment it. I spent 3 months to make this worked ;)
I just fail to understand why couchbase does not provide a php extension for use on "windows" & IIS 7. Is there some efficient other ways of connecting & working with couchbase using php on windows?
I just set up the Couchbase client library today (PHP 5.4 NTS under IIS7). The directions posted at Couchbase's page for the PHP Client Library are accurate for the most part but I wanted to clarify where the dlls go.
Download the zip containing php_couchbase.dll and libcouchbase.dll. Generally you will want the NTS (non-thread safe) version under IIS.
Put php_couchbase.dll in the extensions directory.
Put libcouchbase.dll in the php directory (same directory as php.exe/php-cgi.exe).
If necessary, install the Visual C 9 runtime from Microsoft.
Enable the extension in php.ini
I initially put libcouchbase.dll in the extensions folder per the directions on the Couchbase site. That will not work. (Generates the PHP "the specified module could not be found" dll load error.)
The above only gives you the Couchbase client. You also need a server; that can be locally on the Windows machine or somewhere else.
The Couchbase client SDKs are quite important because they are "cluster aware".
The SDKs, including the PHP one will automatically use all the nodes of the cluster using vBuckets and they will be notified when the topology changes (add new nodes, failover, ...)
Also if you are using Couchbase 2.0 the SDK provides you API to call the views and do more advanced queries on documents.
So the best practice is to use the PHP SDK, that use internally the memcached protocol.
I am inviting you to read:
- http://www.couchbase.com/docs/couchbase-devguide-2.0/couchbase-clients.html
- http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-introduction-architecture-vbuckets.html vBuckets used to manage the auto-sharding.
- http://www.couchbase.com/develop/php/next the PHP SDK main page
A more advanced topic that explains how to developer a client SDK:
- http://www.couchbase.com/docs/couchbase-devguide-2.0/creating-client-library.html
I suppose you are referring to Couchbase 1 (and not the 2.0 version which is currently in Beta).
Couchbase is compatible with memcached. That means you can use any memcached-compatible client to access it, e.g. PHP's memcache or memcached functions.
Update:
If you want to get your hands dirty and compile the PHP extention for the Couchbase SDK yourself, here is a tutorial that guides you through the process.
I have downloaded a dynamic library from the location: http://downloads.php.net/pierre/.
The specific file I downloaded is: php_http-5.3-nts-svn20091125-vc6-x86.zip.
I have copied the file (php_http.dll) into the folder: C:\wamp\bin\php\php5.3.0\ext.
In php.ini, I added the line: extension=php_http.dll.
But I am getting the warning consisting of message: "PHP Startup: Unable to load dynamic library".
Do I need to do anything else to have this module enabled?
Maybe it's for a version other than your PHP's?
There are several "attributes" that must be in agreement in both the php core and the extension module. You can find all those values for the php core in the output of phpinfo()
the API version (e.g. 20090626 for the current 5.3.3 version)
is it a thread-safe (ts) or a non-thread-safe (nts) build <- this one's apparently your problem.
is it a debug build
did the compiler used to build a) the core and b) the module produce compatible code?
An extension module dll can also have additional dependencies that may or may not be fulfilled, e.g. another .dll is referenced but not present. Amongst other tools you can use ProcMon to monitor which .dlls are looked for and which are un-/successfully loaded.
For anyone that has tried the above "answers" without success, do this. Get the official Windows files from here. Make sure to (1) use the right version for your php and (2) use the right threading. Use NTS (not thread safe) if you are using fact cgi, and use thread safe if you have loaded php as an apache module.
http://windows.php.net/downloads/pecl/releases/http/
To verify it worked, look at the phpinfo() output and ensure there is a http section.