I am upgrading my Ubuntu server and installing latest version of PHP i.e PHP 7.0.18, MongoDB 3.2.14, CodeIgniter v 2.2. Now when I am trying to connect with Mongo through CodeIgniter I am getting error as:
The MongoDB PECL extension has not been installed or enabled.
Kindly help. Kindly note my MongoDB and app are in two different instances. From app instance through CLI I can access the MongoDB but through CodeIgniter I am not able to.
Actually I am not able to update the lib file which I am using as per the updated versions.
Thanks.
Go to php.ini and search for the extension and pass the proper extension path like:
extension="/usr/lib/php/extensions/no-debug-non-zts-20100525/mongo.so"
uncomment it by removing the ; from the starting and restart the apache and try again.
Related
I have the latest version of Apache (Apache 2.4), latest version of PHP (PHP7), and latest version of MySQL (not sure the version but I have WorkBench version 6.3). In the past, when I checked if my PHP was working by this line of code <?php phpinfo(); ?> it would show that I have MySQL / mysqli installed and ready to go. But with PHP7 it shows mysqlnd.
I try using mysqli commands to check if I can connect to my database by mysqli_ping() and I also tried connecting to the database using server, user, pass. I keep getting errors such as Class mysqli not found. Or Call to undefined function mysqli_ping(). I've tried searching the net for some answers and All I could find was that I need to install MySQL (but a few sites said it was deprecated).
Am I able to get mysqli for PHP7? Or do I use mysqlnd? What is mysqlnd? Is it a new version of MySQL/mysqli?
Update 2020
For Windows 10 users I strongly recommend windows subsystem for linux (WSL 2) and setup your server there.
If you need php and mysql access in windows environment, then the fastest way is to install Wampserver. If you also need access to php through console then add php location (like C:\wamp64\bin\php\php7.4.11) to environment variables.
If that doesn't suit you and you need full setup always enabled on your system then follow install with choco.
To work properly with apache and load all needed extensions (including php_mysqli) you need ThreadSafe version of PHP, so make sure to download correct version or if you use Chocolatey to manage your windows applications, then just install php with this command:
choco install php --package-parameters='"/ThreadSafe "'.
This will install php in C:\tools\php72 directory, but you can overwrite it with another parameter:
choco install php --package-parameters='"/ThreadSafe ""/InstallDir:C:\PHP"""'.
The mysqlnd extension is part of PHP. It was developed as an alternative to bundling the libmysqlclient, because that library had license conditions that made it awkward to bundle with PHP.
You won't use mysqlnd directly. It's an internal library that is used by mysqli and pdo_mysql as a means to communicate with the MySQL Server.
As for mysqli, yes, it's available for PHP 7. I don't use Windows, but apparently not all extensions are enabled by default.
You probably need to edit your php.ini and uncomment the line
extension=ext_mysqli.dll
or whatever it is for that extension. It might already be in the file, but commented out. So go take a look and see.
Check if your system path environmental variable includes the PHP installation directory. That worked for me on with PHP 7.1 / Apache 2.4 / Windows Server 2016.
I need help installing the driver so I can use the mongo database in php.
This is what I have done so far:
I installed php and am using the built in webserver
I installed mongodb
I added the driver from https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
in to my ext php folder
I added
[Mongo]
extension=php_mongo.dll
in my php.ini file
I did everything right, but it will not load the module.
did I miss something?
I found it is not loading it because phpinfo() does not show it.
Maybe you are using the wrong extension on the mongodb driver, you could check that in here to see wich version of mongodb driver correspond to your PHP version, once you've done that, if you're using windows, you need to tell PHP to use the extension modifying the php.ini file adding the extension like this
Finally you'll need to restart your web server (apache or nginx) so you can use that extension, you verify that making a file with phpinfo(); in it and it should show something like this, if it does then you're ready to go
I see there procedure for intalling Phalcon on various systems. I would like to try out Phalcon, but I can't see a way to uninstall it bringing the system back to the way it was before.
I am aiming to try it out without hampering anything ... on my local machine.
I am using Ubuntu 12.04, Php 5.5.17
If you use ubuntu then it's all about editing php.ini and disabling phalcon extension. Then restarting server to apply new configuration.
Here you can find example of removing GD extension from PHP. You can do analogy with phalcon.
Im on Windows 7, 64/bit running xampp v3.1. The php version is 5.4, Im trying to install memcache locally on the box so I can use memcache with php. I have searched google and followed directions about installing memcached.exe as a service, then downloading the memcache dll extension file for php and putting it into the ext folder under the php folder. I then add it to the php.ini folder, restart apache and memcache does not show up when running phpinfo() and when I try to run memcache via php it tells me this function does not exist. Can anyone help me figure this out? I verified the service is up and running, I tried different versions of the dll php extension file but still same issue. Any suggestions? Here is one site I used for instructions on installing memcache:
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/
There must be some error logged into your apache logs. What is the error?
Looks like I grabbed the incorrect version of memcache for php. You must grab the correct memcache dll file for the php version you are using. I found the correct download here:
http://windows.php.net/downloads/pecl/snaps/memcache/3.0.6/php_memcache-3.0.6-5.4-ts-vc9-x86.zip
It has the correct php version, 5.4 and its thread safe. Once I downloaded it, extracted the dll and put into php extension folder and restarted xampp/apache, it now works.
I using a new server (Rackspace, Ubuntu 10.04) trying to run a php file via linux shell, and the file uses MongoDB to insert and store information being collected. I keep getting an error that is defined in the MongoDB library I am using: "The MongoDB PECL extension has not been installed or enabled"
When I run the same file/script in a browser window, it runs just fine.
A few things to note:
MongoDB php extension is installed and enabled (confirmed via phpinfo)
Using CodeIgniter with the MongoDB library found here: https://github.com/alexbilbie/codeigniter-mongodb-library
Using the CodeIgniter cron job bootstrapper extension found here: http://codeigniter.com/wiki/Cron_job_bootstrapper
I've used all of the above together on a previous, different server without issues.
I'm new to configuring a server 100% on my own, can anyone help me understand why the MongoDB PHP extension would not be recognized when run via shell, but work when accessed via http? Would it be an issue with my server configuration, or does the problem have to do with the libraries I am using?
Ubuntu has two php.ini, one for Apache one for command line. If I remember correctly they are under:
/etc/php5/apache/..
/etc/php5/cli/...