I am new to Node.js and MongoDB. I have successfully got the mongoDB running with node.js and am able to start it up and store data inside of collections. So the server is already running on localhost:27017 and works when accessing localhost:28017 .
Now that I have it running and working within Node, I wanted to test MongoDB out with PHP on my Xampp server running on Ubuntu, but am not able to get the phpinfo() to say it is using mongo yet.
I have followed the steps here to configure and install the driver. I have moved the mongo.so file to my xampps extensions and added the appropriate line in php.ini + restarted. But phpinfo() still doesn't show it.
I guess i am confused on the aspect of where do i put the mongo-php-driver folder? is this installed into the Xampp server as well, if so where do i put it?
It is already running and working using node.js , so was just getting confused why it wasn't working properly or getting connected.
Also while I'm at it, Is it possible to have php and node.js use the same mongoDB server running on port 27017?
EDIT:
I was able to get the server to at least give me an error message about the file after i edited the extension_dir to the correct path
extension_lib = "/opt/lampp/lib/php/extensions/no-debug-zts-20090626"
i am now getting this error
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
i guess I needed to change that php.ini option to get it to load properly. but it seems I have compiled the wrong mongo.so build. I try again.
Thanks
According to this:
http://montenasoft.com/en/blog/how-install-pecl-php-extension-64bit-linux-while-you-are-using-32bit-xampp
Because xampp is compiled with 32 bit, but the mongo driver you compile is 64 bit.
You may have to compile your mongo driver with these:
phpize
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
make
sudo make install
Or just install apache2, mysql, php separately. I think this is a better option.
Related
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/memcached.so' - /usr/lib/php/20131226/memcached.so: undefined symbol: php_msgpack_serialize in Unknown on line 0
Earlier today, I enabled forwarding of messages to root#localhost on my server to beam back to my personal email.
I have been receiving the above error message at 30 minutes intervals since. Of course, I checked and there's a PHP session cleaning script attached to cron to run at 30 minutes interval.
I have been searching around but couldn't find any specific solution.
My setup:
memcached 1.4.25
PHP 7.0
nginx/1.10.0
mysql Ver 14.14 Distrib 5.7.13
Ubuntu Server LTS 16.04
The closest I found to my issue above was this: http://community.rtcamp.com/t/php-warning-error-php-msgpack-serialize/6262 but there's no answer on that thread.
First you need to work out which PHP ini files are being loaded. From command line you can run php --ini. Technically apache/nginx can be running a different version, and you can look up using phpinfo(); exit(); test script if you want to view that one instead. As you're using cron, you're using the command line version anyway.
In one of these files you will find a line similar to:
extension="memcache.so"
If you don't need this extension at all, then just comment it out by prepending it with a ;:
;extension="memcache.so"
If you DO need the extension then it sounds like you need to rebuild this module. The easiest way is using PECL.
pecl install memcache
You might need to follow some instructions whilst running the install. Once it's done, you should be able to run php -v and it shouldn't output the same warning. If this has worked and you just see the php versions, you should restart nginx (if you need it on the website, the command line one should work instantly). :
sudo service nginx restart
I guess you can get a help from a similar topic on the site here.
But briefly, one of your extensions is loading memcache and the path in that is not correct.
You should find it in your php.ini and fix the path manually.
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
Check if msgpack extension is installed and enabled (php -i | grep msgpack).
It seems that PHP in Ubuntu is compiled with it by default.
If it's installed and enabled, then check you memcached extension. Maybe you are using it from a previous installation or something similar.
tl;dr: I eventually had to clear everything PHP that is less than php7.0 from my server manually, along with their related cron jobs.
Long story:
Going through my running process (ps -aux | grep 'php'), I realized php5 is still in there running. Everything on my server uses PHP7, so that lingering process was redundant, plus there was a cron job that runs a session cleaning job on the php5 somewhere, using a script which goes looking for the so-called missing Memcached file.
After removing all phps that are less than php7 from system via apt, I also went in to delete all the existing folders that are less than php7 in /usr/lib/php5 and or /usr/lib/php/ along with their cron related jobs found in /etc/cron.d/php5 and or /etc/cron.d/php/
No more whining warnings from PHP session cleaning about memcache
I was getting a similar error with memcache.so and I noticed there was a new version of memcache that was installed the moment the system ran 'pecl install memcache' (automatically that updated to the latest version). The new version caused that error so I had to change the version 1 version lower to pecl install memcache-4.0.5.2 and it worked. Thanks #Farkie for that insight, that's when I realized that there was a new version that just came out a few days ago and that was it!
Just install msgpack extension and the error message should disappear:
apt install php-msgpack
You might also be missing igbinary extension:
apt install php-igbinary
I have mySQL and PHP 5.5 installed on an AWS EC2 instance. However, when I try
$db = new mysqli($args)
PHP kicks me to the autoloader, as if it can not find the constructor for the mysqli object. I have uncommented extension=mysql.so in the php.ini file, but that does not seem to have accomplished anything. At startup, I get
PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.5/modules/msql.so' - /usr/lib64/php/5.5/modules/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
I thought that mysqli/native driver came prepackaged with PHP5.5, but maybe I was wrong about that. Can someone give me a hint as to how PHP5.5 plays with mysqli?
It doesn't come prepackaged in the case of Amazon Linux. It's an addon module (Assuming you are using Amazon Linux). You can run:
sudo yum install php55-mysqlnd
Maybe misspelled? PHP is trying to load msqli.so, not mysqli.so. Check that you write "extension=mysqli.so", not "extension=msqli.so"
I'm using XAMPP and trying to configure Oracle connection for sql.
I uncommented the line extension=php_oci8.dll and at first it ended up with an error (that oci.dll is missing), but later I downloaded instantclient from Oracle web pages. I tried with versions 10.2, 11.2, and 12.1 but neither worked. Obviously I've added the path to those libraries to my PATH env variable.
The warning I'm getting at the startup of Apache is: PHP Warning: PHP Startup: in Unknown on line 0
The error when I'm trying to connect is: PHP Fatal error: Call to undefined function oci_connect() in ...
I've tried with php_oci8.dll and php_oci8_11g.dll. Those files are in my php/ext directory (they were included in xampp), my instantclient is added to PATH and the warning doesn't show up if I disable those modules. I've tried restarting services and computer.
Can you help me find a solution how to configure it correctly? I'm using Windows 8.1 with administrative privileges.
BTW. My phpinfo() says that OCI8 is activated (but functions like oci_connect still don't work).
EDIT: When I tried running PHP manually I finally got the error to display what was wrong: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application. in Unknown on line 0 Can you help me find out where can I download a correct version?
There was a problem with 64bit version of instantclient. If you ever have the same issue, please install 32bit version of instantclient.
To be honest the easiest way is just to follow PROPER instructions: http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
I tried a lot of other advices and they all went really bad on me (not just because I used different bit version - also I copied the files everywhere following stupid advices and it was hard to correct it)
Its because your Oracle is 64 bit. Remove it and install a 32 bit version of Oracle client and it will work.
It looks like your extension are not install properly. Try to update it or reinstall it with pecl with
pecl install extname
You should also check extension_dir directive in php.ini and check if the PHP folder is added to the path
There's an alternate way to solve this: Install the full Oracle Client, not the basic zip, you can get it at oracle site (about 1Gb):
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-windows-3633015.html
Im using Windows 10, Apache 2.4, PHP 7.1 (all x64) and it works. Also tryed PHP 5.6 and it works too. Still use the php_oci8_11g.dll from the basic client zip to match your php and system version.
You can search the site to find older client versions (11g, 32bits, etc) but Im working with de 12c client and accessing an Oracle 11g enterprise server.
I found a lot of occurrencies of this same error all around, but none gave me this solution. Hope taht helps.
I need the MongoDB PHP driver on my CentOS 5.4 machine. My PHP version is 5.1.6. I downloaded the RPM and installed it. That created several files in /usr/bin directory. I copied
/usr/bin/mongo
to
/usr/lib/php/modules
which was what extension_dir showed on doing phpinfo();.
I also added
extension=mongo.so
in /etc/php.ini.
However on executing my PHP script, i still get
Mongo class not found.
What's going wrong here ?
Also, my phpinfo() shows PHP version 5.1.6 whereas running PHP from command line shows 5.3.3. Could anything be wrong with that ?
Thanks in advance.
You're saying your webserver and command line PHP report different versions. These are going to be installed in different locations, and their extensions are API incompatible with each other.
When you installed the php_mongo extension, it may have used the command line php to determine the directory to install the extension to.
Make sure you have the correct php_mongo for the php version of your webserver, and it is in the correct extensions directory. (get the directory from the php.ini returned by phpinfo())
I hope you realise PHP 5.1 is also many years out of date. Unless you have a specific reason to use a version that old, you should also look at upgrading to a more recent version.
Edit:
Just read your comment "I must also mention that /usr/bin/mongo is a binary executable file but its not having a .so extension. Im copying it as is to /usr/lib/php/modules"
No no no! :)
This is the mongo command line client. This is not the PHP extension!
You can run a find /* -name "mongo.so" to see where the installer put the file, this will probably also give you an indication of which version of PHP it was installed for.
It looks as though you are confusing the RPM-packages for the MongoDB server with the requirements to install the MongoDB PHP driver. The PHP driver provides access to the server from your PHP applications, and does not install any command line tools.
restart httpd !
yum service httpd restart
I have a FreeBSD machine already running PHP 5. I'm trying to get Symfony to work but it requires either pdo_sqlite or sqlite3.
If I type on the command line "sqlite3 --version" it outputs 3.7.5
If I edit my php.ini and uncomment any of the sqlite dll's PHP gives me an error about unknown dll's. I went to sqlite's site and downloaded the sqlite3.dll and tried loading the sqlite3.dll extension but it failed with "Unable to load dynamic library".
At this point I'm really not sure what to do.
I suppose, you need to install databases/php5-pdo_sqlite port and configure your PHP accordingly.