VC compiler version for php extensions creation - php

I've worked with Visual Studio 2008(visual c) to create a php extension, so after writing the c code and compiling the whole project, A dll file has been generated in the debug folder.
I copied this dll file to the php /ext folder ( extensions folder) and I added this line in php.ini
extension=php_talkphp.dll (php_talkphp.dll is the dll name)
then I restart apache server to initialise php extensions. but an error has occured : and this is the error message:
I know that this is due to the compiler version, but How can I use the Vc6 version in a VS2008?
thank you

You need to use the extensions built with the same compiler as your PHP install.
In this case - you are using an installation of PHP built with Visual C++ 6, which is an incredibly old compiler. Your extension is built with Visual C++ 9.0, which is much newer.
You can not mix extensions and PHP installs built with different VC compilers.
Possible solutions:
Get the TalkPHP extension built with Visual C++ 6, and build your own with VC6. You probably will have a hard time getting this since it's an unsupported, unavailable compiler.
or
Install a version of PHP built with Visual C++ 9.0. This will introduce different problems however:
You will either need to switch to using IIS or use a version of apache built with Visual C++ 9.0. Apache Lounge has them.
You will have to install the Visual C++ 9.0 Runtime if you don't already have it.

Related

is there a mongo php extension for visual studio 2010

do they make mongodb php extension for visual studio 2010 (on a win7 32bt operating system) and php version 5.2?
i've seen sites that have the dll for download. (sites listed at the end of this text).
but, looking a the different dlls, i only see them for vc9 and vc11. does that mean that isn't mongo/php extension for my version of visual studio?
any info would be greatly appreciated. thank you.
https://github.com/mongodb/mongo-php-driver/downloads
https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
If you're going to download and use a precompiled PHP extension for MongoDB, the important details to match up are: your version of PHP, what compiler was used, and whether it is 32-bit or 64-bit.
You can get this information from the phpinfo() details or by running php -i from a commmand line.
Look for a "PHP Extension Build" line similar to:
PHP Extension Build => API20100525,TS,VC9
You should then download the latest MongoDB driver DLL zip and find the appropriate DLL to install (matching PHP version, TS vs NTS, and VC version).
For example, with the above output from my 64-bit PHP 5.4 install I would use the php_mongo-1.4.x-5.4-vc9-x86_64.dll.
If your PHP extensions require something other than VC9 or VC11 (which is what the current versions are built with) you can try older driver versions, or ideally update your PHP to a newer version.

Compiling a php extension into a dll

I've been attempting for a last few days to make use of the operator overloading extension (pecl.php.net/package/operator), which has apparently been updated recently to be compatible with 5.3 and 5.4.
I've tried compiling it in windows (64-bit Windows 7) using this guide, with PHP 5.4 and Windows SDK 7.1 without luck. So I tried doing it with PHP 5.3 and Windows SDK 6.1 and I can get it to successfully compile with the config "configure --disable-all --enable-cli --enable-operator" and then "nmake". The problem is that it doesn't produce a dll file for the operator extension, instead what I get is this, which is apparently useless for me. What I want is a dll I can use for my local WampServer setup.
I had had fatal errors when trying to use operator-0.4.1 from the pecl.php.net site, so instead I downloaded and compiled from the git repository (github.com/php/pecl-php-operator), which is what produced the .obj, .idb and .sbr files.
You have to do
configure --disable-all --enable-cli --enable-operator=shared
otherwise it's statically compiled.
Anyway, if you want to use it with WampServer, the binary will probably not work because if I'm not mistaken WampServer is compiled against the VC10 C runtime library, while the guide you linked to instructs you to use Visual Studio 2008 (which comes with VC9). You'll need to use the VC10 compiler (I think it's bundled with Windows SDK 7.1, so you can download just that and skip Visual Studio).
Into extension root path, and modify config.w32
EXTENSION('redis', sources); to EXTENSION('redis', sources,true);
buildconf --force
configure --enable-xx
nmake
you'll get php-redis.dll

WAMPSERVER php_memcache extension

I have a copy of php_memcache.dll (from php_memcache-2.2.6-5.3-nts-vc9-x86.zip) which I have placed in my C:\wamp\bin\php\php5.3.5\ext folder.
In WAMP I can see php_memcache in my extensions list, however whenever I start the extension I get the following warning:
PHP Startup: Unable to load dynamic
library
'C:/wamp/bin/php/php5.3.5/ext/php_memcache.dll'
- The specified module could not be found.
This does not happen for any other extension that I can turn on or off.
Have tried moving php_memcache.dll to C:\windows\system32 but makes no difference.
Any ideas?
Your extension probably not fit the compilation mode of wampserver.
Is it compiled with vc9 (visual 2008) and a non threads safe support ?
My wampserver (latest available) is compiled in VC6 TS.
To know this info check phpinfo() on line :
Compiler
Thread safety
I'd suggest trying other versions of the dll.
2.2.5.0 works for me using WAMP.
The VC9 builds are the only supported builds. VC6 (which is used as convenience builds by Apache) is not supported anymore.
Latest PHP version (and PELC extensions) are only available as VC9 builds. Xamp are already moving their suite to VC9, other already did. You can also do it yourself using apachelounge.com builds, which are the ones we recommend to use with PHP Binaries.

Install APC on Windows

How can I install APC on Windows? I am using PHP 5.3, Windows 7 x64.
I used
pecl install apc
I got
C:\PHP>pecl install apc
downloading APC-3.0.19.tgz ...
Starting to download APC-3.0.19.tgz (115,735 bytes) ............
done: 115,735 bytes 47 source files, building
WARNING: php_bin c:\php\php.exe appears to have a suffix \php.exe, but config
variable php_suffix does not match running: msdev APC.dsp /MAKE "APC - Release"
ERROR: Did not understand the completion status returned from msdev.exe.
Installing an extension with the pecl command means :
downloading the sources
compiling them
And, generally speaking, a windows machine doesn't have what's required to compile software like PHP and/or PHP extensions.
A better / easier solution, in your case, would probably be to find a pre-compiled .dll of the extension, that matches your system and your version of PHP.
With a bit of luck, maybe one of the versions provided on http://downloads.php.net/pierre/ could be OK ?
(It's what kind of acts as replacement of the old pecl4win, until the extensions for windows are available on windows.php.net)
For more informations about which version you should use, take a look at the Which version do I choose? section, in the left side-bar of http://windows.php.net/
It is not really important, whether you are running Windows 32-bit or 64-bit version. What matters is what Apache (webserver) version you have installed (32/64). Since lots of PHP extensions (like APC) are not available for 64-bit systems, most common setup is as follows:
Operating system 32 or 64-bit (not really important). Apache 32-bit will run easily on Windows 64-bit. The difference is, that for 32-bit apache you MUST install PHP 32-bit. Once you install 64-bit PHP, you may find difficult to install some extensions - there are almost no extensions available for 64-bit PHP platform.
therefore your webserver should be 32-bit if you care about special extensions, like APC, Imagick etc... Also you need to know if your apache is thread safe (TS) or not thread safe (NTS) and whether it has been compiled in Visual Studio 6 (VC6) or newser Visual Studio 2008 (VC9). You will easily find all this info from phpinfo() function.
as for the APC, some nice compilation for Windows are available from http://dev.freshsite.pl/php-accelerators/apc.html.
For php 5.3 you use php.net/pierre/php_apc-3.1.10-5.3-vc9-x86.zip.
Download it and copy php_apc.dll to your php ext directory. (I choose the file under ts I have thread safe php installation. There is also an apc dll file for non thread safe.)
Add extension=php_apc.dll into your php.ini file
Restart your web server
Run phpinfo() to see if it's installed or not.
I am using php 5.4 and I downloaded php.net/pierre/php_apc-3.1.10-5.4-vc9-x86.zip and its working fine.
Hope this will help mate.Good luck.
Also, make sure that the compiled version from here http://downloads.php.net/pierre/
matches your php version, otherwise the extension will not load (php v. 5.2.17 requires php_apc.dll v 5.2.17.17 - which doesn't seem to be available as of this writing - I had to downgrade the php version to play with apc).
Another point, pierre's zip packages, at least the one I downloaded, did not include the management script. you can get it from here: http://pecl.php.net/package/APC - select the version you downloaded, then navigate to Browse Source, then find your version in the 'tags' folder. the apc.php script should be there.
There's no available version for php > 5.4.
I'm using APCu instead. Just download the dll and reference it in php.ini.
This website offers updated dll and installers for Apache, PHP and APC compiled to work on windows 64 bit. I've been using it for a while and it works fine. You could an APC version compatible with PHP 5.3.22 here

php_memcache.dll for PHP 5.3

I recently setup a server using the latest version of XAMPP for Windows. With it came PHP 5.3. I'm now looking for a memcache.dll file that works with PHP 5.3 I've used some of the previous .dll files and recieved an error message:
"PHP Startup: memcache: Unable t initialize module.
Module compiled with module API=20060613
PHP compiled with module api=20090626
These options need to match"
Any links to a PHP 5.3 memcache.dll file would be greatly appreciated.
Thanks for the help!
If you are using php 5.3 from within xampp 1.7.2/1.7.3, this distribution works fine:
http://shikii.net/blog/downloads/php_memcache-cvs-20090703-5.3-VC6-x86.zip
It's a real pity that windows.php.net is still not up yet with PECL windows binaries.
Links are not working any more. But you can use following SVN repository to download the file.
http://zhiliansns.googlecode.com/svn-history/r4/trunk/software/php_memcache-cvs-20090703-5.3-VC6-x86.zip
There are compiled extension available from http://downloads.php.net/pierre/
Amongst those, you'll find :
php_memcache-cvs-20090703-5.3-VC6-x86.zip (2009-07-03 05:30 -0700)
php_memcache-cvs-20090703-5.3-VC9-x64.zip (2009-07-03 05:45 -0700)
php_memcache-cvs-20090703-5.3-VC9-x86.zip (2009-07-03 06:11 -0700)
php_memcache-cvs-20090703-5.3-nts-VC6-x86.zip (2009-07-03 05:29 -0700)
php_memcache-cvs-20090703-5.3-nts-VC9-x64.zip (2009-07-03 05:35 -0700)
php_memcache-cvs-20090703-5.3-nts-VC9-x86.zip (2009-07-03 06:07 -0700)
Depending on the version of PHP 5.3 you are using, one of those might do ;-)
If you don't know which one you should choose, take a look at the "Which version do I choose?" block on the left of http://windows.php.net/ (quoting) :
If you are using PHP with Apache 1 or
Apache2 from apache.org you need to
use the VC6 versions of PHP
If you are using PHP with IIS you
should use the VC9 versions of PHP
VC6 Versions are compiled with the
legacy Visual Studio 6 compiler
VC9 Versions are compiled with the
Visual Studio 2008 compiler and have
improvements in performance and
stability. The VC9 versions require
you to have the Microsoft 2008 C++
Runtime (x86) or the Microsoft 2008
C++ Runtime (x64) installed
Do NOT use VC9 version with apache.org
binaries
Maybe one day, extensions will be on this site too (as pecl4win is down)... Would be nice, actually ^^
Found this blog which has a PHP 5.3 version that worked for me:
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/
You should download this extension from code.google.com:
php client for php 5.3(VC6) in xampp
I have php 5.3.13 and in my case the link which seven provided didn't work. But this one did: http://downloads.php.net/pierre/php_memcache-2.2.6-5.3-vc9-x86.zip

Categories