I have been trying to compile a redis.so extension for MAMP using PHP 5.6.2 and I am getting a compiling error. Mostly ‘compiler_globals’ undeclared, but a couple other Zend related ones. I have spent hours trying to get this working.
If I try to compile using PHP 5.5.x as a source I do not have any issues.
Is there anyone who has successfully compiled a redis.so for 5.6.x? If so is it possible to get it posted for download? Anyone have any suggestions as to how to compile without errors?
Please don't post links to instructions on how to do the redis.so compilation as I have read gone through them and it is not working. Thanks.
You will want the source code for PHP. Download it and rename the folder to php. Put this folder into a include folder in the MAMP php directory.
Before ./configure your extension, be sure to run ./configure in the php directory. This will create the proper header files needed for the extensions.
Also, you want to phpize from the Mamp version of php that you are running.
$ /Applications/MAMP/bin/php/php5.3.29/bin/phpize
Related
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
I'm having really hard trouble installing libsodium on my local server (WAMP64).
I used this guide and many others, but still no luck.
I successfully installed PEAR but I can't use it to install the PHP wrapper of libsodium. Can someone post a little guide step by step to help me?
I would appreciate help installing Halite, wich needs libsodium, because maybe it will be my next step.
Thank you everyone.
On Windows, download the appropriate zip file for your version of PHP and then follow these three steps. (I used 1.0.6 for PHP 7.0 in my testing).
Copy libsodium.dll to the System32 Folder or the same directory as php.exe. Also copy it to the apache/bin/ folder (for me that was C:\xampp\apache\bin).
Copy php_libsodium.dll to the PHP extension directory (C:\xampp\php\ext\ for me)
Add extension=php_libsodium.dll to your php.ini file.
The bolded part in step 1 is what I was missing. As soon as I placed the dll in that folder and restarted Apache, everything started working.
You can create a new php file with this code to verify it is working properly:
<?php
var_dump([
\Sodium\library_version_major(),
\Sodium\library_version_minor(),
\Sodium\version_string()
]);
Do Not Try To Install Pecl Extensions On Windows With Pear/Pecl. It Will Not Work.
Rather use pre-compiled .dll file.
The guide page even says so:
Installing Libsodium and the PHP Extension on Windows
On Windows, download the appropriate zip file for your version of PHP and then follow these three steps.
goto WAMPSERVER and install listed PHP
Enable sodium and check in 'Show PHP loaded Extensions' it will get loaded
check-in PHP module if sodium is available or not with the following command
cmd> php -m
cmd> php --ri sodium
if sodium is not listed then go to your /php/php.ini and search for ';extension=sodium' and remove ';' you will be good to go
Im trying to install libsvm on PHP (windows) like this https://github.com/ianbarber/php-svm.
But im trying a couple of times still fail. can anyone give me detailed tutorial?
im using xampp 1.8.3. PHP version 5.5.15
my error is: the program can't start because libsvm.dll is missing from your computer
PHP Startup: Unable to load dynamic library E:\xampp\php\ext\php_svm.dll
im appreciated if someone can help me.. :)
Never done this on Windows and never used xampp before, but the error you are getting is because you need libsvm as well.
The readme in the extension repository that you are using tells you what to do to install it on windows:
Download latest libsvm, rename Makefile to Makefile.old and
Makefile.win to Makefile - nmake Copy libsvm.lib from libsvm windows
directory, and into deps/libs Copy svm.h into includes/libsvm/
buildconf configure --disable-all --enable-cli --with-svm=shared nmake
Make sure the libsvm.dll file from the libsvm windows directory in the
path when running the resulting lib.
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 want to add an extension so I can use my own function in php for example my codes of C but I don't know the requisites and instructions of doing it.I have php5 and OS:Opensuse 11.
I don't know about configure and the codes in shell
there should be something like ext_skel so I can create config files but I don't have it should I download it from somewhere?
Due to this link http://www.tuxradar.com/practicalphp/20/3/0
there should be ext directory but I don't have it.
Thanks in Advance
cd
vi ext/util/config.m4a
./build conf --force
./configure => i don't know here
You should download PHP and then change to the ext directory and follow the tutorial. Don't forget to compile PHP too, because the extension you create depends heavily on the PHP version. I've installed OpenSuse but I don't think it does affect building a PHP extension. You might need some compiler tools etc. I found /php-5.2.6/ext/ext_skel in my PHP path. I've PHP installed in my home directory. You need to install the sources. In OS it's zypper in php5-devel. You can also download the tarball from the PHP site.
Edit: Here is another tutorial about php extension programming.