PHP7 on macOS Sierra Beta Fails to Install - php

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

Related

libexec not showing on folder after installation

i cant load the module of php71 on apache because when i access the folder it doesnt exist "libexec" folder, cant understand whats wrong. Already installed and reinstalled... Any someone had same issue? Im working on macOS
My path is:
usr/local/opt/php71/
Folders available inside are:
INSTALL_RECEIPT.json
README.md
include
sbin
LICENSE
bin
lib
share
NEWS
homebrew.mxcl.php71.plist
php
var
I post here my solution:
$ brew uninstall --force php71
$ brew uninstall --force httpd24
$ brew cleanup
$ brew doctor # fix anything that pops up
$ brew install httpd24
$ which httpd24 # should be the Cellar one, if not, brew link httpd24 / troubleshoot
$ brew install --with-httpd24 php71 # or --with-apache, both may work
$ php -v # should be 7.1.x
$ brew unlink httpd24
In your httpd.conf add:
LoadModule php7_module /usr/local/opt/php71/libexec/apache2/libphp7.so
For updates remember to (unless you actually use the brew-apache ;)):
$ brew link httpd24
$ # brew-php-switcher _version-that-needs-update_ # in case you use it
$ brew upgrade
$ brew unlink httpd24

Unable to install PHP 7 with Homebrew on macOS Sierra

I'm trying to setup Laravel's Valet which, as a dependency, requires PHP 7. When I try to install PHP 7 with Homebrew I get the following error:
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-dbase https://github.com/Homebrew/homebrew-php/issues/3508
php70-intl not found https://github.com/Homebrew/homebrew-php/issues/3591
php70-opcache install issue https://github.com/Homebrew/homebrew-php/issues/3586
Problem installing php70-mcrypt, php70-opcache, php70-xdebug on El Capitan https://github.com/Homebrew/homebrew-php/issues/3587
Add php70-zmq formula https://github.com/Homebrew/homebrew-php/pull/3474
Problem installing homebrew/php/php70-imagick https://github.com/Homebrew/homebrew-php/issues/3571
Install PHP70: Incompatible library version https://github.com/Homebrew/homebrew-php/issues/3444
brew install php70-redis https://github.com/Homebrew/homebrew-php/issues/2762
Allow --enable-redis-igbinary for php70-redis https://github.com/Homebrew/homebrew-php/pull/3473
Add head formula for php70-uploadprogress https://github.com/Homebrew/homebrew-php/pull/3178
This is on a fresh install of MacOS Sierra (actual release, not a beta) with a fresh install of Homebrew (updated). I have installed, ran and agreed to the Xcode licensing agreement.
I have no idea what these errors mean. How can I fix them?
Right I've figured it out. I'm posting the steps to successfully install the require components below in case anybody else stumbles upon this issue:
1). make sure Homebrew is up to date:
brew update
2). Fix the PHP 7 error by making sure Xcode is installed and then typing the following into the Terminal:
brew install apr apr-util
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
sudo ln -s /usr/local/opt/apr/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
sudo ln -s /usr/local/opt/apr-util/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
3). Run the following command (otherwise the PHP installation will complain about missing libz):
xcode-select --install
4). You can now install PHP 7 with Homebrew:
brew install homebrew/php/php70
It may also be important for those using the macOS-delivered installation of Apache with PHP via Homebrew that (quote from Homebrew php70 install):
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system you have to install php with the --with-apache option. See brew options php70 for more details.
I used the following commands to make it work.
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
Here is how I upgrade PHP 5.6 to 7.2 in my Macbook Pro (macOS Sierra)
a. Update the brew package first.
$ brew update && brew upgrade
b. Unlink the old version of PHP if it was installed with Homebrew.
$ brew unlink php56
c. Install the new version of PHP.
$ brew install php72
After installation, it shows:
To enable PHP in Apache add the following to httpd.conf (/etc/apache2) and restart Apache:
d. Using vim edit httpd.conf of apache2.
$ sudo vim /etc/apache2/httpd.conf
Search “php5_module” then commend out the statements as follows:
#Comment out the PHP5 module
#LoadModule php5_module libexec/apache2/libphp5.so
Add the commands as follows:
#Enable PHP 7 module
LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
e. Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.2/
f. Restart Apache service
$ sudo apachectl restart
g. check the php version:
$ php -v
PHP 7.2.7 (cli) (built: Jun 22 2018 06:29:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Done!
Please visit the article "Upgrade PHP version from 5.6 to 7.2 on macOS Sierra (10.12)"
of my blog for more information!
Cheer!

Using pecl to install the Mongodb driver on OS X El Capitan (v10.11.1)

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

io_stream.lo Error 1 when installing php extension

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

Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration

How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl results in the following error:
/private/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf
$ brew install icu4s
$ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
[ Select 1 and enter /usr/local/pear ]
[ Select 4 and enter /usr/local/bin ]
[ Press return ]
$ pear version
Install PECL intl:
$ sudo pecl install intl
$ sudo cp /private/etc/php.ini{.default,}
$ sudo chmod 644 /private/etc/php.ini
$ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.

Categories