PHP pecl inclued: How to compile and install very latest version - php

The installible versions of the pecl extension 'inclued' apparently are incompatible with the latest versions of PHP (I'm using 5.5.9). A bug report has been filed and a fix with updated sources noted. Through svn, I have downloaded the updated files. How do I compile the very latest sources and install them?
This is on a standard EC2 ubuntu instance.

A little bit more googling found the following:
http://php.net/manual/en/install.pecl.phpize.php
Gives fairly straightforward directions on compiling and installing a pecl extenstion.
The makefile name wasn't quite the same and had to use 'php -i' to find the extension directory. Also, restarted apache. But seems to be installed.

Related

No releases available for package "pecl.php.net/imagick"

First of all, I'm sorry if I'm posting a duplicated question. I know there are a few threads about installing imagick on an local machine. But I really can't find any way to fix my php installation.
I want to install the imagick extension for PHP 8.0 But when I try to install with the pecl install imagick command I get the following error:
No releases available for package "pecl.php.net/imagick"
install failed
I am developing on a Macbook. Have a freshly installed Laravel Valet installation. Installed my PHP 8.0 (with homebrew, via valet) and tried to execute pecl install imagick.
I have re-installed imagick & pkg-config with brew reinstall imagick & brew reinstall pkg-config. In that order. After that, I still get the same report.
I have ran brew doctor but don't think there is anything useful in there that could help me. Only some broken symlinks and Unbrewed header files. If you want I can upload the full output, but someone needs to help/tell me how to upload such a big snippet. Just putting it in this question without formatting seems like a bit too much.
Possible duplicated that didn't help me so far:
pecl can't find imagick package
For me it solved with sudo pecl install imagick but that might not be the preferred route.

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 pecl extension - compiling for win 8.1

I would like to compile the php pecl extension ev http://pecl.php.net/package/ev for PHP 5.5+ into a dll-file on Win 8.1 64-Bit.
I have already downloaded the ev source-code and already installed Visual Studio Express(!) 2012. What do i have to do next? How can i compile the source-code?
There is no file->new->project from existing code in Visual Studio Express(!).
I have also already tried to install the pecl exptension with the pecl command. But this doesn´t work:
C:\xampp\php>pecl install ev No releases available for package
"pecl.php.net/ev" install failed
Check install.md file there are all informations what you need.
To be honest you can't install it doing with pecl command because there is information:
Currently GNU/Linux platforms supported only.
There is also manual installation guide but probably you would need to do it with MinGW/MySYS if any. I suppose you would need to edit sources.
mingw-w64 project has replaced mingw and mingw-build.
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.1/threads-posix/sjlj/
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.1/threads-posix/sjlj/
you can of course pick a different version number by going up to a parent dir in the file tree. for example, if you look in the personal builds, you would find the most up-to-date:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/dongsheng-daily/4.9/
gcc uses not .lib files but instead .a files for libs, and php includes a .lib for devs, so immediately I know it's for VC++ (and it was compiled with that and it says so for the windows target download).
after you have correctly configured MSYS (not an easy job),
./configure;make;make install
./configure gives me the error:
configure: error: xml2-config not found. Please check your libxml2 installation.
libxml2 requires python, which certain windows antivirus packages remove from mingw-w64.

Trouble Installing mcrypt library on Mavericks (10.9)

I was able to successfully install the mcrypt extension on Mountain Lion but I'm having a difficult time installing the extension on Mavericks.
For reference, I'm following this guide: http://www.coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
The only inconsistency I've noticed is that by running php -v from the command line, I'm showing PHP version 5.3.15 - whereas the web server appears to be running 5.4.17. I downloaded 5.4.17 to compile mcrypt.
Basically, everything runs according to plan until the very end. Rather than installing the shared extensions into the new directory, /usr/lib/php/extensions/no-debug-non-zts-20100525, I get a message that says:
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
EDIT:
The issue appears to be that the web server's PHP was compiled with module API: 20100525 and the system is still using 5.3.15 (which is API: 20090626), hence the error.
I'm assuming you can't (easily) update the system version of PHP. What do I need to do to get the module and PHP APIs to match?
Thanks in advance for any help.
For reference of others finding this thread..
Here is an automated Mcrypt installer for 10.8 and 10.9.
http://topicdesk.com/downloads/mcrypt/mcrypt-download
Less than a minute to install this way.
I noticed that php 5.4.17 is located in /usr/bin and 5.3.15 is in /usr/local/bin,
so I:
created symlinks in /usr/local/bin to phpize and php in /usr/bin.
After I verified that phpize -v and php were pointing to the correct version, it was simply a matter of recompiling the mcrypt extension. After doing so, the extensions were installed in the correct directory:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20100525/
I think in retrospect all I needed to do was add /usr/bin to my path variable so that it checks /usr/bin before /usr/local/bin.

Using PECL to install extensions on Windows 7

I've been trying to install some PECL extensions on my laptop, but I've ran into a few problems. Whenever I run pecl install whatever from the command line I get a message saying ".\php.exe appears to have a suffix .exe, but config variable php". It seems like PECL is using PEAR to perform installations. I checked and php_suffix is located in the files PEAR_Config.php and PEAR_Builder.php, but I'm not sure what to do with it in there.
Any ideas on how to fix this or workarounds? Unfortunately the pecl4win seems to be down, and http://downloads.php.net/pierre/ the site I usually go to for the .dll's has outdated versions for the version of PHP I'm using (5.3.1).
Unfortunately I don't know the specifics, but at least I can point you in the right direction To use pecl on windows, you need to setup Visual Studio c/c++ or MingW32 c/c++ and then configure pecl to use either compiler for building the requested extensions.
Unlike pear packages, pecl packages are PHP c extensions that needed to be compiled against your local PHP install.
Update
https://wiki.php.net/internals/windows/stepbystepbuild A mostly friendly wiki page on setting up a windows box for building PHP from source. Looks like you need to build the interpreter and support libraries before you can get pecl working.

Categories