I'm trying to install mongo php extension on OSX 10.11 but the command:
sudo pecl install mongo
gives the following error:
...
In file included from /private/tmp/pear/install/mongo/io_stream.c:34:
/private/tmp/pear/install/mongo/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
^
1 error generated.
make: *** [io_stream.lo] Error 1
ERROR: `make' failed
brew install openssl
ln -s /usr/local/Cellar/openssl/1.0.2d_1/include/openssl /usr/local/include/openssl
You need to disable the Mac OSX El Capitán rootless mechanism:
Boot with Cmd-R
Open Terminal
Type csrutil disable
Reboot
On the Mac, You need to install Xcode, and build the symlink for the openssl comes with Xcode,
i.e.
cd /usr/include;
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl .
i.e. /usr/include/openssl points to Xcode library.
Build your mongo php library.
Once it is done, you should have to enable the rootless security protection:
Boot with Cmd-R
Open Terminal
Type csrutil enable
Reboot
evp is high-level cryptographic functions.
Try to install development libraries:
Ubuntu: sudo apt-get install libssl-dev
CentOS: yum install openssl-devel
Source: Error while installing mongo driver for PHP on amazon linux
I am using OS X and have a custom build of openssl in /usr/local/openssl
so:
ln -s /usr/local/openssl/include/openssl /usr/local/include/openssl
The solution from Scott Wiersdorf seems to worked for me https://solitum.net/openssl-os-x-el-capitan-and-brew/
install opnessl through brew
brew install openssl
Link the openssl
$ cd /usr/local/include
$ ln -s ../opt/openssl/include/openssl
Related
I am trying to install a PHP MongoDB driver but the installation is failing because it cannot locate the OpenSSL.
/Users/username/mongo-php-driver/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c:24:10: fatal error: 'openssl/sha.h' file not found
#include <openssl/sha.h>
^
1 error generated.
make: *** [src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1
I read that this has something to do with the latest version of MacOS? Is there a way to do it, as I really need to install this driver.
This is the only solution that worked for me.
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
Source: https://www.anintegratedworld.com/mac-osx-fatal-error-opensslsha-h-file-not-found/
You’ll need to install OpenSSL using homebrew, and tell homebrew to create symlinks:
brew install openssl
brew link openssl --force
If you don’t already have homebrew installed, you can get it by running this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And before all that, if you haven’t already installed XCode and the XCode command-line tools:
xcode-select --install
First install libressl using brew:
brew install libressl
Then run the following:
export LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/lib \
-L/usr/local/opt/expat/lib" && export CFLAGS="-I/usr/local/opt/openssl/include/ \
-I/usr/local/include -I/usr/local/opt/expat/include" && export \
CPPFLAGS="-I/usr/local/opt/openssl/include/ -I/usr/local/include \
-I/usr/local/opt/expat/include"
You can use environment variable C_INCLUDE_PATH to tell the compiler to include the path to openssl header files.
For example, if you just want to do it once:
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include pecl install mongo
Reference: charles.lescampeurs.org
I currently have PHP 5.6.23 installed on my system.. However, I am trying to install PHP7 on my system (macOS Sierra Beta), I'm trying to do this with brew install homebrew/php/php70.
However, I get the following error:
$ brew install php70
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
==> Installing php70 from homebrew/php
==> Downloading https://php.net/get/php-7.0.9.tar.bz2/from/this/mirror
Already downloaded: /Users/Removed/Library/Caches/Homebrew/php70-7.0.9
==> ./configure --prefix=/usr/local/Cellar/php70/7.0.9 --localstatedir=/usr/local/var --sy
Last 15 lines from /Users/Removed/Library/Logs/Homebrew/php70/01.configure:
checking for pthreads_lib...
Configuring SAPI modules
checking for Apache 2.0 handler-module support via DSO through APXS...
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /usr/sbin/apxs follows:
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
configure: error: Aborting
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/Homebrew/homebrew-php/issues
These open issues may also help:
php70-yaf https://github.com/Homebrew/homebrew-php/issues/3328
Install PHP70: Incompatible library version https://github.com/Homebrew/homebrew-php/issues/3444
No solr available for php70 yet https://github.com/Homebrew/homebrew-php/issues/3454
brew install php70-redis https://github.com/Homebrew/homebrew-php/issues/2762
php70-imagick has warnings https://github.com/Homebrew/homebrew-php/issues/2766
Add head formula for php70-uploadprogress https://github.com/Homebrew/homebrew-php/pull/3178
"brew upgrade" fails: php56 conflicting with php70 when upgrading phpmyadmin https://github.com/Homebrew/homebrew-php/issues/2945
10.6.8 "brew install php70" failed with Error 139 https://github.com/Homebrew/homebrew-php/issues/2708
Adds a new php70-gearman formula that updates php56-gearman https://github.com/Homebrew/homebrew-php/pull/3120
Why does wp-cli formula try to install php56 if php70 is already there? https://github.com/Homebrew/homebrew-php/issues/3179
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
The outcome of brew doctor is this:
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Any guidance/help would be much appreciated!
Try this:
$ brew link apr-util --force
$ brew link apr --force
$ which apu-1-config
/usr/local/bin/apu-1-config
$ which apr-1-config
/usr/local/bin/apr-1-config
$ sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ sudo ln -s /usr/local/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ sudo ln -s /usr/local/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew update && brew install apr apr-util
$ brew link apr-util --force
$ brew link apr --force
$ which apu-1-config
$ which apr-1-config
$ sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ sudo ln -s /usr/local/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ sudo ln -s /usr/local/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ brew install php70
In terminal,
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
will install php7 on macOS Sierra, I just tested.
Edit httpd.conf (located in /etc/apache2/) file.
Comment below line.
#LoadModule php5_module libexec/apache2/libphp5.so
I am trying to install the php mongo driver for OS X. I've tried following these instructions to no avail.
$ which pecl -> /usr/local/Cellar/php56/5.6.13_2/bin/pecl
$ sudo pecl install mongo -> full build results here but the problem the is the error:
In file included from /private/tmp/pear/install/mongo/io_stream.c:34:
/private/tmp/pear/install/mongo/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
My Xcode command-line tools are up to date (I used $ xcode-select --install to be sure).
I'm sure how to fix this problem.
I managed to get around this by installing OpenSSL using Homebrew (as suggested here):
$ brew install openssl
$ brew link openssl --force
Then
$ sudo pecl install mongodb
Do this
$ cd /usr/local/include
$ ln -s ../opt/openssl/include/openssl
I recommend using http://phpbrew.github.io/phpbrew/ for this type of thing. It let's you easily install any extensions to any php version you require.
When installing a new version of php, I usually keep an eye on the log while it compiles. There might be dependencies that need installing first. Also, make sure you have an updated version of homebrew installed.
You need to disable the Mac OSX El Capitán rootless mechanism:
Boot with Cmd-R
Open Terminal
Type csrutil disable
Reboot
On the Mac, You need to install Xcode, and build the symlink for the openssl comes with Xcode, i.e.
cd /usr/include;
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl
I tried to install the mongodb driver for PHP on Amazon Linux.
While running sudo pecl install mongo, I get the error message:
fatal error: openssl/evp.h: No such file or directory
#include <openssl/evp.h>
^
compilation terminated.
make: *** [io_stream.lo] Error 1
ERROR: `make' failed
PEAR Version: 1.9.5
PHP Version: 5.3.29
I installed gcc which helped me progress further with the install till this error.
The best Guide I was able to find was here:
http://jonathanhui.com/install-mongodb-amazon-linux
PHP's guide: http://php.net/manual/en/mongo.installation.php
evp is high-level cryptographic functions.
Try to install development libraries:
Ubuntu:
sudo apt-get install libssl-dev
CentOS:
yum install openssl-devel
The right package to install is not libssl-dev but
sudo apt-get install pkg-config
and now you can execute
sudo pecl install mongodb
Don't forget to add extension=mongodb.so to your php.ini file.
To know which php.ini file is loaded you can create and simple php file on vps
<?php
php_info()
?>
Example directory php.ini in phpinfo()
I am trying to install this
http://fr2.php.net/manual/en/book.ssh2.php
on a Centos 5 (a fork of RHEL 5).
I installed libssh2 (yum install libssh2) which is located in /usr/lib, and when I install SSH2 extension (via pecl install -f ssh2) I get this message
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found. You can obtain that package from http://sourceforge.net/projects/libssh2/
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr' failed
If I set /usr/lib, I get the same message
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr/lib' failed
Where is the problem?
Installing libssh2 via tar.gz from http://sourceforge.net/projects/libssh2/ help a lot (--with-ssh2=/usr/local/include/).
But :
yum install libssh2-devel
...is a better idea.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-0.12
$ echo 'extension=ssh2.so' | sudo tee /etc/php5/mods-available/ssh2.ini > /dev/null
$ sudo php5enmod ssh2
yum install libssh2-devel didn't work for me:
No package libssh2-devel available.
So I downloaded rpm package from rpmfind and installed with rpm -ivh
After that just added extension=ssh2.so to /etc/php.d/ssh2.ini
This is updated answer from #klay + modification from #avn from comment under working solution for PHP 7.x.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-1.0
$ echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
$ sudo phpenmod ssh2
Regarding line:
echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
Make sure that path /etc/php/7.2/mods-available is valid and there is a match with your php version.
I'm running on Centos, none of these answer were the entire solution for me. I followed these instructions:
$ sudo yum install -y gcc php-devel php-pear libssh2 libssh2-devel
But php-devel would not install, complaining about conflicts. I searched yum to find what php devel packages I had available
$> yum search php|grep devel
...
php55u-devel.x86_64 : Files needed for building PHP extensions
php56u-devel.x86_64 : Files needed for building PHP extensions
php70u-devel.x86_64 : Files needed for building PHP extensions
...
So I ran
$> sudo yum install -y php56u-devel
And it installed cleanly. Then, continuing with the instructions, I ran
$ pecl install -f ssh2
And it compiled. Then I added the extension to php
$ touch /etc/php.d/ssh2.ini
$ echo extension=ssh2.so > /etc/php.d/ssh2.ini
And on my system, instead of
$ /etc/init.d/httpd restart
I had to do
$ sudo /bin/systemctl restart php-fpm.service
So that was all the steps to install. And finally to confirm:
$> php -m|grep ssh2
ssh2
I had this problem:
I'm on a Pair.com "Advanced" hosted account, so I'm a little limited on what I'm allowed to do. I don't think I can yum nor aptitude nor any of the other pre-compiled packages.
I've downloaded and compiled libssh2. During the pecl process, it asks where the library is located. It's in "~/usr/local/lib" and I've tried several variations, including fully qualified. But I kept getting the same error.
The error message doesn't spell out precisely which file it's looking for. libssh2.so is in that directory. I know the output is supposed to be ssh2.so. I wondered if there is supposed to be an ss2.something, or libssh.nothing?
I fixed it thus. In my case, after compiling libssh2 I downloaded the PEAR tarball. The trick was:
./configure --with-ssh2=<libssh2 location> --prefix=<libssh2 location>
Another trick is that, since Pair.com is running FreeBSD, I have to do a "cd ." after the ./configure command. Otherwise, make produces a "Permission denied" error. Apparently, this is necessary on all *nix BSD flavors.
The error:
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found.
...can be seen in the source code.
The logic in the code reveals that it will throw this error if it cannot find /include/libssh2.h in either /usr/local, /usr or in the path supplied by the optional --with-ssh2=[DIR] directive. In other words, without customising the directive, it needs to find one of the following:
/usr/local/include/libssh2.h
/usr/include/libssh2.h
If it passes this check, it then assumes it can find the libssh2 lib at /usr/local/lib or /usr/lib.
Hopefully the info above is enough to help someone debug their issue. My own case is fairly specific and unusual (macOS with Homebrew in a custom install path), but in case it helps anyone else, here's my horrifically hacky workaround. Works perfectly lol
In a nutshell I'm creating two temporary symlinks so that pecl can find ssh2 where it expects.
# First check that neither /usr/local/include nor /usr/local/lib exists
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/include /usr/local/include
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/lib /usr/local/lib
pecl install -a ssh2-1.3.1
sudo rm -rf /usr/local/include
sudo rm -rf /usr/local/lib