Background:
1. How can i install gearman php extension on Windows OS?
2. Installing gearman PHP extension on Windows using cygwin and pecl
Following the answer in 1. question, I've made my cygwin work, downloaded and compiled gearman, and got the first gearman worker example to work:
Problem:
To run the same example from PHP script, I still need PHP extension. Somewhere I've seen that I might get to install PECL extension using PEAR, so:
I've downloaded go-pear.phar into C:\...\php5.6.16
ran php go-pear.phar
installed PEAR in system mode -> success
Now I can do: C:\...\php5.6.16>pecl install gearman which gives:
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl
channel-update pecl.php.net" to update
downloading gearman-1.1.2.tgz ...
Starting to download gearman-1.1.2.tgz (30,961 bytes)
.........done: 30,961 bytes
3 source files, building
ERROR: The DSP gearman.dsp does not exist.
Which would indeed be a sorcery if it worked, as that extension should be probably built/compiled accordingly to PHP itself. What is the least painful way to make this work? Is there a way how to do this without installing Visual Studio? I've also seen Net_Gearman PEAR package that might perhaps be wrapped / tweaked to be used just as the PECL one?
I'm currently using WAMP3.1.1 with PHP5.6.16 it comes with + VC15 x64 Thread Safe PHP7.2.2, need Gearman to work with at least one of those two. Any help appreciated
I've followed these 2 guides:
https://www.sitepoint.com/compiling-php-from-source-on-windows/
https://wiki.php.net/internals/windows/stepbystepbuild
1. I've downloaded:
Visual Studio 2012
.NET Framework 4.7.1 (which at the end just flashed a message that it's already installed)
Windows SDK _X_EN_DVD.iso
php-sdk-binary-tools-20110915.zip
deps-5.6-vc11-x64.7z (dependencies)
php-src-php-5.6.16.zip (GitHub release)
2. Compiled PHP
(note this is all from Native Tools Command Prompt, I didn't even actually start VS at all)
used just configure --disable-all --enable-cli --enable-pdo
3. Tried to compile PECL Gearman
found out it can't really be done on Windows
4. Found Gearman wrapper for Windows:
mhlavac/gearman on GitHub
Related
I need to use PHP pthreads on Mac OS High Sierra, but Homebrew is no longer supporting downloads of PHP --with-thread-safety.
How do I get and install a thread safe version of PHP for Mac OS, Php v7.1.16 without homebrew?
If it is going to have to be some sort of manual install - does anyone have step by step directions for the mac or know where I can get instructions?
I have been looking on the internet for instructions for 5 hours now. I'm tired and can't believe that no one has any posted info on this.
I was able to get PHP 7.2.5 installed on Mac OS HighSierra with ZTS/Thread safety by using phpbrew.
Install Steps I took:
Downloaded phpbrew from http://phpbrew.github.io/phpbrew/ and installed with their directions. Please note at the end of the installation, they give you further instructions for setting up your ~/.bashrc to load phpbrew, look for them at the terminal.
Once you have phpbrew running you are ready to install php with zts by using the command below (of course you can install all of the extensions that you like by checking the installation for extension instruction)
phpbrew install php-7.2.5 +openssl='/usr/local/opt/openssl/' -- --enable-maintainer-zts --with-curl=/usr/local/
It is important to have openssl and curl already installed before installing php and you must point to their location on your computer at the install line as I have done above. You can add all the extensions you need, but you must have the openssl and curl because I had a ton of problems with installation without them. But you could try omitting.
For those of you who are using PHP ZTS so that you can go on to install pthreads --ONLY PHP 7.2 and above works with Krakjoes pthread-master which you can download and follow the installation at https://github.com/krakjoe/pthreads
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 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.
Documenting my struggles to help others and hopefully get some feedback on how I could have done it better.
The command pecl install pthreads fails due to the php installed on my ubuntu 13.04 box not having zts configured.
Options:
1) The ubuntu respository does not have a php package with zts enabled. As of this post, ubuntu only has php 5.4.9 in it's repository (Released: 22 Nov 2012). It is possible to compile a php version from source - which I eventually did (see below), but..
2) I .. ALSO .. wanted to use phpfarm for the ability to run different versions of PHP on my local setup. On github, there is Christian Weiske's original contribution here (phpfarm) and a fork that he has contributed to, by François Poirotte - also called phpfarm. Francois' fork has a few more options to configure ('post-install customization') but I was not able to make that work with a PECL extension. I'm curious to know if misunderstood how to do that, because it looks to me that it just simply does not take PECL commands.
3). Prior to recompiling php from source, I loaded phpfarm (tried both versions), enabled php-fpm (FastCGI) and was able to get my apache2 server to use a phpfarm version (5.5.10) which showed up in a phpinfo() output. But the php-cli always showed the original php version (5.4.9) in the cli (run: php -v). Running (run: php -i | grep php.ini) showed /etc/php5/cli but I had previously removed php5 and aptitude show php5 returned a state of 'not installed.' I even renamed the /etc/php5 directory to see if I could force the system to use the phpfarm php version. Obviously, this is incorrect thinking and I went on to simply compile php 5.6 from source. But, is there something more to do to get a phpfarm php to be used in the cli? I read that the cli loads it's configuration file on a per command basis, unlike the apache2. If I could have run the 5.5.10 version (configured with zts) then I could have then done pecl install pthreads and then re-complied the phpfarm 5.5.10 version with pthreads enabled. Although it appears I will be able to run various versions of php in the apache server, will I ever be able to switch-phpfarm to another version and see it working in the php-cli? Also, I was uncertain on where I could have loaded a pthreads file for the phpfarm compile process to find and use it; could I have done it that way?
4) This stackoverflow post, essentially posted by Joe Watkins - the developer of pThreads is a perfect how-to on getting pThreads installed on a Ubuntu system that has had php configured with zts (Zend Thread Safety). (Thanks Joe!)
A nice tutorial on using phpfarm configured with fast-cgi and the apache server to help run websites under different php configurations.
So what gives with php, php-cli and the phpfarm?
I'm not sure about phpfarm, but do know of another solution ...
Multi
A tool for maintaining multiple installations of PHP in multiple configurations
https://github.com/datingvip/multi
This is a bit more user orientated, will allow you to build many configurations and versions of php, any tagged release of php, and any patched version from any fork of php-src.
In addition, because I wrote it, it will install pthreads for you.
git clone https://github.com/datingvip/multi
cd multi
VERSION=5.5.10 DBG=no-debug ZTS=zts ./php.multi
The above commands will yield an installation of PHP (in one suitable configuration, of one version) in /opt/php.
Look at php.defaults for configuration options and adjust before building
Should configuration fail on, for example, something related to a library like libxml2, it will usually be the case that
sudo apt-get install library-dev
Where library is replaced with the name of the library holding up the build, will fix the problem for you. If it does not, a quick google should get you going again.
Once the build is complete
source /path/to/multi/php.env 5.5.10
Note: multi will always install pthreads for any zts version automatically
I hope that gets you somewhere ...
I am working to run "ogr2ogr" command in terminal.
I got this error message.
dyld: Library not loaded: libcurl.4.dylib Referenced from:
/usr/local/bin/ogr2ogr Reason: Incompatible library version: ogr2ogr
requires version 8.0.0 or later, but libcurl.4.dylib provides version
7.0.0
There is a mismatch between the system requirement and library requirement. As I can tell, the latest curl is version 7 http://curl.haxx.se/download.html,
why is this asking for version 8? I also tried to upgrade curl with brew
but couldn't symlink into /usr/local, because would cause conflicts with
the OS.
In order to figure this problem: I started by figuring out if the Curl is used by different
$$ Which curl
/usr/bin/curl
I installed GDAL on mac by fellowing these instructions (StackOverFlow Post).
To explore where the ogr2ogr is, I run the command.
$$ which ogr2ogr
/usr/local/bin/ogr2ogr
I fellowed these instructions :
Download curl sources: http://curl.haxx.se/download/curl-7.25.0.zip
Unarchive the zip file somewhere
Open a Terminal window and go to the directory containing curl sources
Type: CFLAGS=-m64 ./configure
Type: make
Type: sudo make install
Source :
But it doesn't work out.
Another approach
I downloaded this file, unzip it into the bin/ directory, but when I tried to run it. I got this problem
../../bin/libcurl.4.dylib: cannot execute binary fil
There is one answer I found that seems very helpful, but I couldn't find it very practical.
If you didn't define the --with-curl option when running GDAL
./configure, then
GDAL will link with the curl library indicated by "curl-config --libs"
You likley have several libcurl on your system and the one that got used when
linking GDAL is not the one available at runtime.
The 8.0.0 or 7.0.0 don't necessarily reflect the "human readable" version of
the curl library. It might be some other numbering scheme related to how the
API/ABI of the library evolves, or something linked to packaging.
How can we do that in a practical way.
I read many articles before posting this question here, Anyone have any ideas on how to solve this problem ?
Have you checked this out?
Python Anaconda linking
I did that, then simlinked some stuff:
ln -s libcurl.4.0.0.dylib libcurl.3.dylib
Another error came up, now pertaining to libxml2.
I did:
brew install libxml2 libxslt
brew link --force libxml2 libxslt
And now ogr2ogr is finally working