MongoDB on Wamp x64 (win x64) = mongo.native_long error - php

I've a big problem with my development environment.
Context :
My computer : Win 8.1 x64
My WampServer install : x64
My MongoDB install : x64 from http://www.mongodb.org/downloads
I've installed the php extension from http://pecl.php.net/package/mongo.
My problem is that our production server store some 64 bits INT into the database.
When I try, in my development environment, to access to this data, I've got:
MongoCursorException
Cannot natively represent the long 1108547148863410176 on this platform
I found on internet that a parameter of mongoDB called "mongo.native_long = 1" is needed to use 64 bits INT on 64 bits architecture.
But when I try to add this param in my "php.ini" file, the server don't start and give me an error like :
[19-Nov-2014 18:25:52 UTC] PHP Fatal error: PHP Startup: To prevent data corruption, you are not allowed to turn on the mongo.native_long setting on 32-bit platforms in Unknown on line 0
Does my mongoDB extension DLL is build on 32 Bit or I missed something to do ?

For me the only thing that worked was:
ini_set('mongo.long_as_object', 1);
Hope it saves someone's time. It's one of those stupid things that make you wonder:
"Why the hell did I become a programmer?"
EDIT: getting proper driver from http://pecl.php.net/package/mongo helped me. I've downloaded latest driver. Check your version using phpinfo() command. E.g. for me, on 64-bit Win7 it's:
PHP Version 5.5.12
PHP Extension Build: API20121212,TS,VC11
Notice the "TS,VC11" string. It means it's Thread Safe, but your version may not be thread safe (NTS).
So I downloaded 64bit, TS for PHP 5.5. I was dealing with this problem long time and finally, proper driver solved this issue.

When using a 32 bit apache console(like wampp or xampp) u should add the following to your php.ini file:
mongo.long_as_object= 1
The above line should convert all longs to object, this way the exception won't occur.
Hope this helps all the 32 bit users that have this problem.

I had the same problem with WAMP x64 on Windows X64. My fix was to update the Mongo library to 1.6.14

C:\wamp64\bin\php\php5.6.35 in php.ini add : mongo.long_as_object = 1
and
C:\wamp64\bin\apache\apache2.4.33\bin in php.ini add : mongo.long_as_object = 1

Related

Call to undefined function printer_list()

I'm getting Call to undefined function printer_list() cuz my php_printer.dll isn't working and in the error log I'm getting PHP Startup: Unable to load dynamic library.
c:/wamp64/bin/php/php5.6.31/ext/php_printer.dll
I searched the entire web for php_printer.dll that works with php 5.6.31 and I didn't find it, I'm working with wampserver 3.1 on windows 7 can anyone help?
Looking at the one issue on that git repo I see that gimjudge has complied these DLL's for 32 PHP only. Their reasoning being that until PHP7 the 64bit PHP versions were actually only experimental. PHP only became truly 64 bit as of PHP7.0
So to use this dll you would have to install the 32bit version of WAMPServer. Then you will probably have no problems activating this DLL.
You can download the 32bit version of WAMPServer 3 from here Its the backup repo and much easier to see what you are doing and which version you are downloading than the normal SourceForge repo.
Make sure you have backed up all you site(s) and databases before installing the 32bit WAMPServer.
However it is possible to install the 32bit AND 64bit WAMPServer on the same PC as the default folder names are different (C:\wamp or C:\wamp64) the Apache and MySQL service names are also different (wampapache or wampapache64) and (wampmysqld or wampmysqld64)
Although its not a good idea to start both at the same time as this will use a lot of memory for no good reason.

PHP extensions on Windows 8 (wamp) : confusion: 32 bit or 64 bit

I have 32-bit Windows 8.1, processor is x64 Intel Pentium
I am running apache 2.4.9 and php on wampserver
phpinfo: PHP Version 5.5.12 , Architecture x86, Compiler MSVC11 (Visual C++ 2012)
Trying to install php_mongo.dll
If I use php_mongo-1.5.5-5.5-vc11-x86_64.dll I get 0xc000035a windows error,
when i use php_mongo-1.5.5-5.5-vc11.dll I get PHP error "Fatal error: Class 'MongoClient' not found in ..." and extension php_mongo is marked with exclamation mark in wamp php extensions menu: see picture
OK
Point 1, If you are running a 32bit Windows as you say then you have to use the 32bit WampServer ( which I assume you did ) and also the 32bit mongo extension.
Point 2, In WAMPServer is you get a Warning symbol like that against a PHP Extension it usually means one of 2 things :-
You have a dll in the \ext folder but no extension=??? in php.ini to match it.
You have an extension=??? in php.ini but no dll in the \ext folder that matches it.
If the above info does not solve your issue then, this recent similiar question, seems to suggest that the php_mongo-1.5.1-5.5-vc11.dll worked for that questioner when the 1.5.5 version did not. I would try that version, remember you will need the Thread Safe version i.e. the file without the -nts in its name.

PHP 5.4.16 and FreeTDS (php_dblib.dll): Unable to load extension

Goal
Connect to a MSSQL 2008 R2 server using the FreeTDS (php_dblib.dll 0.82 + 20110906 patches) Drivers for PHP 5.4.16 (VC9).
I am unable to use any alternative to FreeTDS unless the client also decides to use an alternative. This is unlikely unless they also run into this issue when upgrading their current version of PHP (currently 5.3.x) tomorrow.
Issue
PHP is unable to load the FreeTDS extension.
The Apache error log displays this on server start:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_dblib.dll' - The specified module could not be found.\r\n in Unknown on line 0
As far as I understand it, the extension is either unable to be found or is the wrong version?
The extension directory location in the php.ini has been checked and triple checked and is:
c:/wamp/bin/php/php5.4.16/ext/
That leads me to believe it is the wrong version of php_dblib.dll. I've also checked that multiple times and made sure to use the version for PHP 5.4.X Thread Safe.
Steps Taken
Clean install of WAMP 2.4 with PHP 5.4.16 and Apache 2.4.4
Thread Safe php_dblib.dll placed in PHP extension directory
extension=php_dblib.dll added to the correct php.ini
extension=php_mssql.dll and extension=php_pdo_mssql.dll disabled in php.ini
msvcr71.dll (DotNet framework 1.1) added to PHP root directory
freetds.conf added to server root directory (c:)
System Details
WAMP Server 2.4
Apache 2.4.4
PHP 5.4.16 (VC9)
Thread Safety: enabled
FreeTDS Thread Safe (php_dblib.dll) 0.82 + 20110906 patches
Microsoft SQL Server 2008 R2
msvcr71.dll (DotNet framework 1.1) only included in the PHP root directory
EDIT:
WAMP 2.4 32-bit
OS: Windows 7 Pro 64-bit
EDIT 3
Last update only applied to the 64-bit version of WAMP. I've installed the 32-bit version, again, and --without-dblib is no longer in the configure command section of the phpinfo().
Questions
With the information given, is there anything else you'd need to know about to give an accurate assessment of the situation?
I am unable to find any, but are there any known issues with FreeTDS 0.82 and PHP 5.4.16?
Temporary Defeat
I've rolled back to PHP 5.3.x for now, FreeTDS works fine on that version. I'm not sure that it will make a difference with the little bit of code I am actually delivering to the client. This was intended to be a "double" check to make sure it all works perfectly, but since I'll be on site during the install I can fix any issues if they come up.
I would like to find a solution eventually since more and more of the systems I work with every day are going to be upgraded to php 5.4 and beyond.

Wrong ELF class - PHP extension

I am trying to load a PHP extension (sdo.so) but I am getting the following error when I try to run XAMPP.
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/sdo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/sdo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
From what I've seen other people say it seems to be something to do with it being compiled on a 64bit machine and it needs 32bit. Is this the root of the problem? If so how would I compile it as 32bit in Fedora 17 as I've only seen solutions for Ubuntu and couldn't get them to work for me.
From what I've seen other people say it seems to be something to do with it being compiled on a 64bit machine
It doesn't matter on which machine you compile (the build host). What matters is for what machine you compile (the target host).
You are (apparently) running a 32-bit ix86 PHP, so you need to compile sdo.so for 32-bit ix86 as well.
how would I compile it as 32bit in Fedora 17
./configure CC='gcc -m32' CXX='g++ -m32' && make && make install
should be about it.

php_redis.dll not working in windows

I tried both the files from here: https://github.com/nicolasff/phpredis/downloads. I am using 64bit wampserver on windows 7 professional. It looks like apache is trying to load the file but somehow could not recognize it properly. This is what I see in the error log:
PHP Startup: Unable to load dynamic library
'D:/wamp/bin/php/php5.3.13/ext/php_redis.dll' - %1 is not a valid
Win32 application.
Anyone faced similar issues? Do we have a working solution for this?
Just in case it can help someone, I managed to solve the error on PHP 7.1.12 installing the 32 bits DLL.
I was getting the error:
Warning: PHP Startup: Unable to load dynamic library '.../php_redis.dll'
not a valid Win32 application
But after installing the 32 bits version, the warning disappeared.
To know which architecture of XAMPP/WAMP are you using, visit the phpinfo() and look for the value "Architecture", it was for me on the fourth row, and as expected is had the value x86.
I had to check the Server API from phpinfo() to decide which version to use
If It's
Apache 2.0 Handler(mod_php) go with Thread Safe version
If It's CGI go with Non Thread Safe version
Unfortunately I do not run 64-bit version of PHP to test this, but for PHP 5.3 you can try this dll.
Dll from https://github.com/nicolasff/phpredis/downloads ( php_redis-2.1.3-5.2-vc6-ts-4350b2a.zip ), is working fine with PHP 5.2.17 (32-bit version).
I hope you will solve the problem.
I used XAMPP x86 / PHP 7.2.5 so I needed redis x86 and the directory is this: C:/xampp/php/ext/.
https://pecl.php.net/package/redis/4.1.0/windows
I'll add my ansewer to the table :
I used those dlls for my AMPPS server (WAMP should be the same) under windows 8 with PHP 5.5:
https://pecl.php.net/package/redis/2.2.7/windows
following this tutorial
https://www.linkedin.com/pulse/using-redis-windows-php-shekhar-joshi
I had same issue for 64 bit windows 7 wampserver with PHP5.5.12
and worked for me from below link dll binaries of Redis
http://windows.php.net/downloads/pecl/releases/redis/2.2.7/
I had the same case, I was installing wamp 32bit, but I imported the library in 64bit however I had to imorted the 32bit version.
Check in the task manager which version of wamp you are using!
For me the reason was version of Redis PHP extension that I've been used.
xampp architecture: x64
php version: 7.4
php type: ts (thread safe)
redis version installed on windows: 3.0.504
and finally the version of Redis PHP extension that worked for me was:
for php 7.4
latest stable version: php_redis-5.3.4-7.4-ts-vc15-x64
I downloaded it from this Link

Categories