So I've tried almost all the tutorials I've found here and on other sources but the problem is always the same. The extension is not installed when I call the phpinfo method.
I've added the file mongo.so to the extensions folder and I've called it on the php.ini as extension=mongo.so.
I'm using MAMP 2.2 on Mavericks and the php version is 5.5.3.
Appreciate any kind of help.
The output of phpinfo() will tell you which php.ini file (if any) is in use.
You have to modify that php.ini file and add extension=mongo.so and then restart your webserver.
One thing you need to keep in mind when you are installing the MongoDB driver for MAMP is the pecl command you are using is actually the MAMP command, not some alternative PHP install you may have on your system.
To do this, locate the PHP binary distributed with MAMP, and the use the full path to the pecl command of the MAMP installation.
Related
Environment in local system
MAMP 3.2.2
PHP 5.6.24
Webserver Apache
Mongodb for caching is installed successfully and found running in MongoDBservice.
I Downloaded Mongodb drivers from https://pecl.php.net/package/mongodb (used thread safe versions PHP5.6 "php_mongodb.dll") selected php_mongo-1.1.8-5.6-ts-vc11-x64.zip, Made changes to php.ini as extension=php_mongo.dll
I just copied and pasted .dll file in my C:\MAMP\bin\php\php5.6.24\ext
So far good... After restarting my MAMP I cannot see mongo in phpinfo ---->This is my issue
Any idea about this?
Thank you
Just copying the DLL file to the correct directory is not enough. You also need to add the following line to your php.ini file before the MongoDB extension is available:
extension=php_mongo.dll
After that restart Apache and MongoDB should show up as an available extension in phpinfo().
By the way, that is also mentioned on the official PHP website for installing the MongoDB driver: http://www.php.net/manual/en/mongodb.installation.windows.php
Should be extension="php_mongodb.dll instead of extension="php_mongo.dll as it is the name of the file you copied.
In my case, I first downloaded a x64 version of php_mongo.dll, which did not show in phpinfo page. Then i downloaded a x86 version and everything works fine. Hope this helps.
PS. Make sure you pick the right php version.
I'm having huge problems installing memcached extension for php.
Currently using:
OS: Windows 10 x64
PHP: 7.0.1 via XAMPP
Apache: 2.4.18 (Win32)
I have successfully installed memcached in C:/memcached the service is running.
But the problem starts when trying to add the memcache php extension. I've tried numerous versions of php_memcache.dll and non seem to be working. I did include the extension in php.ini extension=php_memcache.dll
When i run php -m memcache is not listed and at the top i recieve the error:
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_memcache.dll' - The specified module could not be found.
And when I try running a test.php for memcache initialization i recive the Class not found exception
This is a huge problem, because I need it for running selenium tests.
The memcached service doesn't actually install the PHP memcached extension for you. It only installs the memcached server used to store your cache.
You'll need to download the Windows DLL from the PECL repository first (click on the blue Windows DLL link). Then you must add the extension=php_memcache.dll line to the correct php.ini file for your SAPI. Also, note the extension DLL file needs to be placed in the correct path for your XAMPP installation.
For Apache, simply create a script in your document root with the line <?php phpinfo(); and try loading that in your web browser. You should see a line at the top labeled Loaded configuration (php.ini) which gives you the full path to your loaded php.ini file. On Windows the path may actually appear different than what is stated in phpinfo() if you installed PHP through something like XAMPP. So you may need to rely on XAMPP to locate the correct php.ini file.
For the CLI SAPI, you can use php.exe --ini to do the same. Again, you may need to rely on the XAMPP package if it has modified your configuration path (since this is a compile time directive).
After making your changes to php.ini you will need to restart PHP for the changes to take effect.
Since you're using PHP 7 on Windows it's probably also important to note that the compiled DLL from PECL may not actually work under apache for Windows, because you're more than likely using a theaded SAPI. So make sure you are downloading the correct version. As far as I can tell that version is only compiled to work with up to PHP 5.6. The github alternative, for PHP 7, available at https://github.com/nono303/PHP7-memcahe-dll as mentioned in the comments is tested under non-thread safe. So you may only be able to get this working for your CLI scripts on Windows.
I have installed MAMP 3.5 with Apache 2.4.16 on Yosemite 10.10.5 and have run into some obstacles that I find hard to solve.
The first issue was that virtual host settings have changed in Apache but that I managed to fix.
The remaining problem is with extensions. I use gettext in an application and it can not be found.
php -v says PHP 5.6.10 (cli)
phpinfo() says PHP 5.5.27
php --ini says /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
The php.ini path seems to be correct although phpinfo() says that extension_dir is /usr/lib/php/extensions/no-debug-non-zts-20121212
This seems very strange to me? The gettext extension is not in this directory but is found along with all other relevant extensions in the directory listed in the php.ini file for PHP 5.6.10 which is the one that should be used...
Any ideas what has gone wrong and how I can make PHP use the correct ini file?
CLI uses the installed version of OSX, MAMP uses it's own version.
The easiest way to use same version for both is to add the MAMP version first in your path in ~/.bash_profile.
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php7.0.0/bin/:~/bin:$JAVA_HOME/bin:$PATH
of course you need to replace the php7.0.0 part with the version you want to use.
Quit your terminal app and reopen it, and try php -v again.
I wanted to install composer on my other computer. I have encountered this question before but none of the answers seem to work for me.
I tried enabling the openssl package in php.ini but it is already enabled. i tried changing the include path in my php.ini file. I reinstalled mamp . But none of the above fix the problem.
i'm using php 5.6.8
I fixed the problem by putting the php.ini file in the c:\windows file, it's a messy solution but it works. I can't use MAMP PRO anymore for some reason it keeps crashing, but it works on MAMP and i installed composer.
I suggest to take the following steps to make sure that the openssl extension gets loaded:
determine where your PHP is: open a command prompt, then php --ini.
find under "Loaded Configuration File" the path to the active php.ini
make sure this php.ini has extension=php_openssl.dll
I think you either have multiple PHP version installed and the Composer installer picks the one, where you didn't modify the php.ini or starts php without an php.ini.
(There are server stacks for windows with composer support out of the box, like wpn-xm. Sorry, shameless plug.)
Here is what I have in my PHP.ini:
extension=php_apc.dll
...
[APC]
apc.enabled = 1
I'm running Apache 2.0.59, PHP version 5.2.3 on Windows Server 2003.
I've already installed XDebug compiled with vc6. Thus, I got the APC version 5.2 vc6. Here are both filenames that I downloaded (and put the *.dll in php/ext/).
php_apc-3.1.5-5.2-vc6-x86.zip
php_apc-3.1.5-5.2-nts-vc6-x86.zip
I got them here.
I've tried rebooting the server and in both cases, I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library './ext/php_apc.dll' - The specified module could not be found.\r\n in Unknown on line 0
Try using the full drive letter and path to extension_dir in php.ini:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:\somedir\php\ext"
And restart Apache after making the change.
(It might very well be something else, but this is the first thing I check on Windows systems -- those pesky filepaths.)
First, I went here
Then, I downloaded Collection of PECL modules for PHP 5.2.3
Then, I extracted the php_apc.dll file and copied it in the ext/ folder
Restarted Apache
It works!
To complete other answers:
Using the non thread safe (NTS) version of the DLL instead of the thread safe one solved the problem for me.
That is, only the NTS version was compatible with my WAMP installation.
You could check this:
Note: On Windows, APC needs a temp path to exist, and be writable by the web server. It checks the TMP, TEMP and USERPROFILE environment variables in that order and finally tries the WINDOWS directory if none of those are set.
http://php.net/manual/en/apc.installation.php
You have to be sure that the DLL has the correct architecture level. I had the same problem trying to load the file from php_apc-3.1.10-5.4-vc6-x86.zip. It didn't work, while the DLL from php_apc-3.1.10-5.3-vc6-x86.zip worked. I don't know how to find the right file without fiddling in the PHP repository though. HTH.
My problem was that I had listed apcu before apc.
extension=apc
extension=apcu
Reordering them so apcu was first, solved my issue.
In my case, I'm using macOS Catalina and was trying to install extension APCU for PHP 5.6.
So i ran below commands:
brew install autoconf
pecl channel-update pecl.php.net
pecl install apcu-4.0.11
At this stage my php5.6 ini got input extension="apcu.so"
But i was getting warning saying the apcu.so wasn't found under
/usr/local/lib/php/pecl/20131226/ directory.
The installer put the apcu.so at /usr/local/Cellar/php#5.6/5.6.40/pecl/20131226/apcu.so
so i copied the apcu.so to the desired directory
cp /usr/local/Cellar/php#5.6/5.6.40/pecl/20131226/apcu.so /usr/local/lib/php/pecl/20131226/
and i'm done.