Memcached issue - php

I am working on OSX 10.10.5, using AMPPS 3.2, PHP 5.6. I am trying to install memcached to work with PHP but no luck so far.
What I have done so far:
I have installed downloading the sources
Using homebrew (also update it)
Using pecl
First time I tried I got an error about architecture did not match, then I realized that the PHP version with AMPPS is 32bits and OSX is 64bits so I added this flag: CFLAGS='-arch i386' which solved that issue but now I got another errors:
memcached support => enabled
Version => 2.2.0
dyld: lazy symbol binding failed: Symbol not found: _memcached_lib_version
Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/no-debug-non-zts-20131226/memcached.so
Expected in: flat namespace
dyld: Symbol not found: _memcached_lib_version
Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/no-debug-non-zts-20131226/memcached.so
Expected in: flat namespace
Any ideas?

Related

Install PHP 7.0 Internationalization extension (Intl) on XAMPP on Mac

I followed the instructions outlined here:
Install PHP Internationalization extension (Intl) on XAMPP on Mac
Ran sudo pecl install intl
selected the correct files from the Cellar
then this error happened:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error:
'ext/standard/php_smart_str.h' file not found
include
^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed
No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h
So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....
re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.
I have php 5.5 on my mac, deep in the usr/local/bin folder
so next step was to get pecl to use those files and generate an intl.so file....
Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)
Ran php and came up with this error:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so'
- dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so,
9): Symbol not found: _zval_used_for_init Referenced from:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
Expected in: flat namespace in
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
in Unknown on line 0
I imagine it has to do with different versions?
In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?
Install intl.so in PHP 7 seems impossible?
After a lot of research I was finally able to resolve this. Detailed steps here:
before you begin, check which php path is set. it should be /Applications/XAMPP/xamppfiles/bin/php. If not you can change it by PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}". more detail here
Overall idea is to build the intl-extension from PHP source code on your own. Before you begin make sure you have installed Xcode. Also, install the latest version of autoconf. this might help:
brew install autoconf
Next download the version of PHP you use in XAMPP from php.net. I am using 7.1.18. This version worked for me: php-7.1.31, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well. Do let me know if it does or doesnt, I’ll update this post. Do not use PHP 7.3 for Magento 2.3.0, it is not supported.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
Restart your Apache using XAMPP GUI and it should work.
So far, it seems that extension intl.so for php is bundled with php
and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.
So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.
Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm
The error means that XAMPP doesn't have PHP compiled with intl. You may try:
pecl install intl
but probably it won't work as well.
See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.
As for the workaround, try installing memcached extension instead of memcache, e.g.
pecl install memcached
Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.
If you wanna try without homebrew, with native apache and php, look at my aswer here: https://stackoverflow.com/a/55131868/3692846

PHP 'MongoClient' Not Found

There are tons of questions on this topic, but none of them have worked for me. I originally had the mongodb driver installed (and working) using
sudo pecl install mongo
however according to the pecl output this has been deprecated and replaced with
sudo pecl install mongodb
So I installed that, changed mongo.ini to load extension=mongodb.so instead of mongo.so (as instructed to by the output of the above pecl command) . When I load my phpinfo() page it shows that it is loaded
mongodb version 1.0.0
mongodb stability stable
libmongoc version 1.2.0
libbson version 1.2.0
However, when I try to use MongoClient in my PHP page, I get the following error:
Fatal error: Class 'MongoClient' not found in /srv/www/site/functions.php on line 500
I have exhausted all of the 'similar questions' suggested when creating this question, as well as google searches. So I'm hoping someone has some first-hand experience with fixing this because I feel like I'm out of options.
Turns out the class names have changed in the new driver. So MongoClient not existing is a valid error.
new MongoDB\Driver\Manager is the replacement for MongoClient

Symlink for libxml2 not working after installing and configuring

I am currently have two PHP version in my server ;
PHP version 5.2.11 - the current version of the php in the server
wherein many programs uses it. Have libxml2-2.6.16 as libxml2 version.
Virtually Installed PHP
PHP version 5.4.44 - the virtually installed version of php in the server. Since, I upload my project in the server which uses Symfony
Framework. As symfony requirement, php version must be at least have
a php version of 5.3. And so, we installed this PHP version virtually.
After setting all the necessary configuration, we run it in the browser using its customize port. Unfortunately,the page gives this error.
Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 3070] CT 'container': The content model is not determinist. (in file:////home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd - line 20, column 0)' in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:96 Stack trace: #0 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(218): Symfony\Component\Config\Util\XmlUtils::loadFile('/home/sanchez/...', Array) #1 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/home/sanchez/...') #2 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(48): Symfony\Component\DependencyInjection\Loader\XmlFileLo in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php on line 220
To understand more about the error, I research in the internet and find some related topics that may help. Then,, I found out that it is all about the libxml2, so I installed another libxml2 version in my directory (personal) and just use symlink for it to point to my directory. By the way I install, libxml2-2.8.0 as libxml2 version. I am also using RHEL4.After setting again the neccessary configuration , it still give the same error as above.
How can I solve this? Is it really possible to have two libxml2 version on the server? Do I miss any configuration or something? Is my libxml2 version and php version 5.4.44 is compatible? Or there is any libxml2 that is compatible with my php version? What should I do?
Appreciate any help.Thanks.

how to use MongoDB in laravel4?

I have successfully installed Mongodb on my win 7 system. I also installed php extension for MongoDB on my Wamp server and it works perfectly; yet I wish to know how I can use MongoDB in my laravel4 projects. I will like to use mongovel package but when I run 'composer update' there is always an error: php extension not found in your system. Also I installed jessengers package but got an error: MongoClient not available. Please I need help on how to get out of this. Thanks
You need to make sure that the extension is also available on the command line. In many cases there is a different php.ini for CLI. You can find this out by running:
php --ri mongo
if that does not provide any sort of output about version and settings, you don't have it installed properly.
Then you can use php --ini to find out where your INI files are - the ones that are used for running PHP on the command line

Installing ZendDebugger.so on OS X PHP 5.3.19

I'm trying to get the ZendDebugger.so extension loaded in my custom (homebrew) PHP 5.3.19 install on OS X Mountain Lion, and all I get is:
Failed loading /path/to/php/extensions/ZendDebugger.so: dlopen(/path/to/php/extensions/ZendDebugger.so, 9): Symbol not found: _executor_globals
Referenced from: /path/to/php/extensions/ZendDebugger.so
Expected in: flat namespace
That's what I get from php -m, php -v and the error_log.
It's not an architecture error, as I'm using 64 bit (and tried 32 on a lark) and I can't find anyone with this issue online. Is it just the PHP version? Some compilation flag missing? I can't figure it out.
Edit: ZendDebugger.so downloaded from: http://www.zend.com/en/products/studio/downloads and using the 5.3.x version.

Categories