Valet-plus: Switching PHP versions does not work in 1.0.17

Created on 11 Jun 2018  路  18Comments  路  Source: weprovide/valet-plus

I removed everything in /usr/local/etc/php/ and ran valet fix, then valet install. After that, everything works.

When I try to switch PHP-versions, it now gives a geoip-error:

valet use 7.0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
Password:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

When I comment extension="geoip.so" in /usr/local/etc/php/7.1/php.ini and retry switching versions, I get the next error:

valet use 7.0
[[email protected]] Unlinking
Unlinking /usr/local/Cellar/[email protected]/7.1.18... 75 symlinks removed

[libjpeg] Relinking
[[email protected]] Linking
Warning: Already linked: /usr/local/Cellar/[email protected]/7.0.30
To relink: brew unlink [email protected] && brew link [email protected]

[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
PHP Warning:  readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

Warning: readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

In Brew.php line 274:

  Unable to determine linked PHP.


use [<phpVersion>]

After running rm -rf /usr/local/etc/php/* && valet fix && valet install, everything works again, but PHP 7.1 is used again.

Most helpful comment

rm -rf /usr/local/etc/php/5.6/
rm -rf /usr/local/etc/php/7.0/
rm -rf /usr/local/etc/php/7.1/
rm -rf /usr/local/etc/php/7.2/
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
valet fix
valet install

php -v

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

valet use 7.0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

All 18 comments

@luukschakenraad Thanks for creating a new ticket so we can help you.

PHP Warning:  readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

Warning: readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

This error usually occurs when the PECL configuration isn't set correctly. Please try to use valet fix or brew update && brew upgrade. And then show us the result of php -v

@Neodork See the first line of my post. I already ran valet fix. It's a repeating issue:

rm -rf /usr/local/etc/php/* && valet fix && valet install => everything works
valet use 7.0 => it breaks
rm -rf /usr/local/etc/php/* && valet fix && valet install => everything works
valet use 7.0 => it breaks

The full flow:

rm -rf /usr/local/etc/php/* && valet fix && valet install

```sure you want to delete the only file in /usr/local/etc/php [yn]? y
Password:
Removing all old php56- packages from homebrew/php tap

Removing all old php70- packages from homebrew/php tap

Removing all old php71- packages from homebrew/php tap

Removing all old php72- packages from homebrew/php tap

Removing all old n98-magerun packages from homebrew/php tap

Removing drush package from homebrew/php tap

[php5.6] Disabling modules: apcu, intl, mcrypt
[php7.0] Disabling modules: apcu, intl, mcrypt
[php7.1] Disabling modules: apcu, intl, mcrypt
[php7.2] Disabling modules: apcu, intl, mcrypt
Installing and linking new PHP homebrew/core version.
Uninstalling /usr/local/Cellar/[email protected]/7.1.18... (514 files, 67.1MB)

==> Downloading https://homebrew.bintray.com/bottles/[email protected]_sierra.bottle.tar.gz
Already downloaded: /Users/luuk/Library/Caches/Homebrew/[email protected]_sierra.bottle.tar.gz
==> Pouring [email protected]_sierra.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_ini /usr/local/etc/php/7.1/php.ini system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_dir /usr/local/share/[email protected] system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set doc_dir /usr/local/share/[email protected]/doc system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20160303 system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set bin_dir /usr/local/opt/[email protected]/bin system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set data_dir /usr/local/share/[email protected]/data system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set cfg_dir /usr/local/share/[email protected]/cfg system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set www_dir /usr/local/share/[email protected]/htdocs system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set test_dir /usr/local/share/[email protected]/test system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_bin /usr/local/opt/[email protected]/bin/php system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

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.1/

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/[email protected]/lib
CPPFLAGS: -I/usr/local/opt/[email protected]/include

To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
php-fpm
==> Summary
馃嵑 /usr/local/Cellar/[email protected]/7.1.18: 514 files, 67.1MB

Unlinking /usr/local/Cellar/[email protected]/7.1.18... 0 symlinks removed

Linking /usr/local/Cellar/[email protected]/7.1.18... 75 symlinks created

If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

Please check your linked php version, you might need to restart your terminal!
Linked PHP should be php 7.1:
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

[PECL] Checking pear config...
Checking php 5.6...
Skipping 5.6, Pear config path could not be found at: /usr/local/etc/php/5.6/pear.conf
Checking php 7.0...
Skipping 7.0, Pear config path could not be found at: /usr/local/etc/php/7.0/pear.conf
Checking php 7.1...
Checking php 7.2...
Skipping 7.2, Pear config path could not be found at: /usr/local/etc/php/7.2/pear.conf
[php] Checking for errors within the php installation...
[nginx] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[mysql] Stopping
[redis] Stopping
[devtools] Installing tools
[devtools] wp-cli already installed
[devtools] pv already installed
[devtools] geoip already installed
[binaries] Installing binaries
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
apcu_bc is already installed, skipping...
apcu_bc successfully enabled
geoip is already installed, skipping...
geoip successfully enabled
[PECL-CUSTOM] Installing extensions
[[email protected]] Restarting
[dnsmasq] Restarting
[mysql] Stopping
[mysql] Configuring
[mysql] Restarting
[redis] Restarting
[mailhog] already installed
[nginx] Restarting

Valet installed successfully!

`valet use 7.0`

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

`php -v`

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

`rm -rf /usr/local/etc/php/* && valet fix && valet install`

sure you want to delete the only file in /usr/local/etc/php [yn]? y
Removing all old php56- packages from homebrew/php tap

Removing all old php70- packages from homebrew/php tap

Removing all old php71- packages from homebrew/php tap

Removing all old php72- packages from homebrew/php tap

Removing all old n98-magerun packages from homebrew/php tap

Removing drush package from homebrew/php tap

[php5.6] Disabling modules: apcu, intl, mcrypt
[php7.0] Disabling modules: apcu, intl, mcrypt
[php7.1] Disabling modules: apcu, intl, mcrypt
[php7.2] Disabling modules: apcu, intl, mcrypt
Installing and linking new PHP homebrew/core version.
Uninstalling /usr/local/Cellar/[email protected]/7.1.18... (514 files, 67.1MB)

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/[email protected]_sierra.bottle.tar.gz
Already downloaded: /Users/luuk/Library/Caches/Homebrew/[email protected]_sierra.bottle.tar.gz
==> Pouring [email protected]_sierra.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_ini /usr/local/etc/php/7.1/php.ini system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_dir /usr/local/share/[email protected] system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set doc_dir /usr/local/share/[email protected]/doc system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20160303 system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set bin_dir /usr/local/opt/[email protected]/bin system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set data_dir /usr/local/share/[email protected]/data system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set cfg_dir /usr/local/share/[email protected]/cfg system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set www_dir /usr/local/share/[email protected]/htdocs system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set test_dir /usr/local/share/[email protected]/test system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_bin /usr/local/opt/[email protected]/bin/php system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

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.1/

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/[email protected]/lib
CPPFLAGS: -I/usr/local/opt/[email protected]/include

To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
php-fpm
==> Summary
馃嵑 /usr/local/Cellar/[email protected]/7.1.18: 514 files, 67.1MB

Unlinking /usr/local/Cellar/[email protected]/7.1.18... 0 symlinks removed

Linking /usr/local/Cellar/[email protected]/7.1.18... 75 symlinks created

If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

Please check your linked php version, you might need to restart your terminal!
Linked PHP should be php 7.1:
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

[PECL] Checking pear config...
Checking php 5.6...
Skipping 5.6, Pear config path could not be found at: /usr/local/etc/php/5.6/pear.conf
Checking php 7.0...
Skipping 7.0, Pear config path could not be found at: /usr/local/etc/php/7.0/pear.conf
Checking php 7.1...
Checking php 7.2...
Skipping 7.2, Pear config path could not be found at: /usr/local/etc/php/7.2/pear.conf
[php] Checking for errors within the php installation...
[nginx] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[mysql] Stopping
[redis] Stopping
[devtools] Installing tools
[devtools] wp-cli already installed
[devtools] pv already installed
[devtools] geoip already installed
[binaries] Installing binaries
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
apcu_bc is already installed, skipping...
apcu_bc successfully enabled
geoip is already installed, skipping...
geoip successfully enabled
[PECL-CUSTOM] Installing extensions
[[email protected]] Restarting
[dnsmasq] Restarting
[mysql] Stopping
[mysql] Configuring
[mysql] Restarting
[redis] Restarting
[mailhog] already installed
[nginx] Restarting

Valet installed successfully!

`php -v`

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies
```

My bad missed the first line. Could you show us the output of ~/.pearrc.

I've just updated my previous post to show you the full flow.

cat ~/.pearrc

#PEAR_Config 0.9
a:1:{s:10:"__channels";a:3:{s:5:"__uri";a:0:{}s:11:"doc.php.net";a:0:{}s:12:"pecl.php.net";a:0:{}}}%

Looks like the pear configuration for [email protected] does not exist (also 5.6 and 7.2). Your only working version should be [email protected]. That's what valet-fix tells me:

[PECL] Checking pear config...
Checking php 5.6...
    Skipping 5.6, Pear config path could not be found at: /usr/local/etc/php/5.6/pear.conf
Checking php 7.0...
    Skipping 7.0, Pear config path could not be found at: /usr/local/etc/php/7.0/pear.conf
Checking php 7.1...
Checking php 7.2...
    Skipping 7.2, Pear config path could not be found at: /usr/local/etc/php/7.2/pear.conf

Try reinstalling these brew uninstall [email protected] && brew install [email protected]. You might also want to remove the config folder but you already mentioned that you removed all the config folders the OP.

I've reinstalled PHP 7.2 and PHP 7.0 and installed PHP 5.6:

brew uninstall [email protected] && brew install [email protected]
brew install [email protected]
brew uninstall [email protected] && brew install [email protected]

Then valet fix:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

Then:
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
rm -rf /usr/local/etc/php/5.6/*.ini && rm -rf /usr/local/etc/php/5.6/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.0/*.ini && rm -rf /usr/local/etc/php/7.0/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.1/*.ini && rm -rf /usr/local/etc/php/7.1/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.2/*.ini && rm -rf /usr/local/etc/php/7.2/php-fpm.d/*.ini

Then:
valet fix && valet install

valet fix && valet install
Password:
Removing all old php56- packages from homebrew/php tap

Removing all old php70- packages from homebrew/php tap

Removing all old php71- packages from homebrew/php tap

Removing all old php72- packages from homebrew/php tap

Removing all old n98-magerun packages from homebrew/php tap

Removing drush package from homebrew/php tap

[php5.6] Disabling modules: apcu, intl, mcrypt
[php7.0] Disabling modules: apcu, intl, mcrypt
[php7.1] Disabling modules: apcu, intl, mcrypt
[php7.2] Disabling modules: apcu, intl, mcrypt
Installing and linking new PHP homebrew/core version.
Uninstalling /usr/local/Cellar/[email protected]/7.1.18... (514 files, 67.1MB)

==> Downloading https://homebrew.bintray.com/bottles/[email protected]_sierra.bottle.tar.gz
Already downloaded: /Users/luuk/Library/Caches/Homebrew/[email protected]_sierra.bottle.tar.gz
==> Pouring [email protected]_sierra.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_ini /usr/local/etc/php/7.1/php.ini system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_dir /usr/local/share/[email protected] system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set doc_dir /usr/local/share/[email protected]/doc system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20160303 system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set bin_dir /usr/local/opt/[email protected]/bin system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set data_dir /usr/local/share/[email protected]/data system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set cfg_dir /usr/local/share/[email protected]/cfg system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set www_dir /usr/local/share/[email protected]/htdocs system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set test_dir /usr/local/share/[email protected]/test system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear config-set php_bin /usr/local/opt/[email protected]/bin/php system
==> /usr/local/Cellar/[email protected]/7.1.18/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

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.1/

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/[email protected]/lib
    CPPFLAGS: -I/usr/local/opt/[email protected]/include


To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary
馃嵑  /usr/local/Cellar/[email protected]/7.1.18: 514 files, 67.1MB

Unlinking /usr/local/Cellar/[email protected]/7.1.18... 0 symlinks removed

Linking /usr/local/Cellar/[email protected]/7.1.18... 25 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

Please check your linked php version, you might need to restart your terminal!
Linked PHP should be php 7.1:
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

[PECL] Checking pear config...
Checking php 5.6...
Checking php 7.0...
Checking php 7.1...
Checking php 7.2...
[php] Checking for errors within the php installation...
[nginx] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[mysql] Stopping
[redis] Stopping
[devtools] Installing tools
[devtools] wp-cli already installed
[devtools] pv already installed
[devtools] geoip already installed
[binaries] Installing binaries
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
    apcu_bc is already installed, skipping...
    apcu_bc successfully enabled
    geoip is already installed, skipping...
    geoip successfully enabled
[PECL-CUSTOM] Installing extensions
[[email protected]] Restarting
[dnsmasq] Restarting
[mysql] Stopping
[mysql] Configuring
[mysql] Restarting
[redis] Restarting
[mailhog] already installed
[nginx] Restarting

Valet installed successfully!

php -v

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

valet use 7.0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

Looks like you're removing the .ini file after install. If you install a brew PHP version it will add the desired php.ini within the /usr/local/etc/php/{version} folder.

Change:

brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
rm -rf /usr/local/etc/php/5.6/*.ini && rm -rf /usr/local/etc/php/5.6/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.0/*.ini && rm -rf /usr/local/etc/php/7.0/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.1/*.ini && rm -rf /usr/local/etc/php/7.1/php-fpm.d/*.ini
rm -rf /usr/local/etc/php/7.2/*.ini && rm -rf /usr/local/etc/php/7.2/php-fpm.d/*.ini

To:

rm -rf /usr/local/etc/php/5.6/
rm -rf /usr/local/etc/php/7.0/
rm -rf /usr/local/etc/php/7.1/
rm -rf /usr/local/etc/php/7.2/
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]

rm -rf /usr/local/etc/php/5.6/
rm -rf /usr/local/etc/php/7.0/
rm -rf /usr/local/etc/php/7.1/
rm -rf /usr/local/etc/php/7.2/
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
brew uninstall [email protected] && brew install [email protected]
valet fix
valet install

php -v

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP 7.1.18 (cli) (built: May 25 2018 19:18:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies

valet use 7.0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/geoip.so' - dlopen(/usr/local/lib/php/pecl/20160303/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

Show me the first 10 lines of cat /usr/local/etc/php/7.1/php.ini.

head -n 10 /usr/local/etc/php/7.1/php.ini

extension="geoip.so"
extension="apcu.so"
extension="apc.so"
extension_dir = "/usr/local/lib/php/pecl/20160303"
[PHP]

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for

ls /usr/local/lib/php/pecl/20160303

apc.so  apcu.so

Oke weird, looks like geoip is enabled but not installed. Check pecl list to see installed modules my guess would be it shows no geoip so install it: pecl install geoip.

pecl list

Installed packages, channel pecl.php.net:
=========================================
Package Version State
apcu    5.1.11  stable
apcu_bc 1.0.4   stable
geoip   1.1.1   beta

pecl install geoip

pecl/geoip is already installed and is the same as the released version 1.1.1
install failed

pecl uninstall geoip && valet fix && valet install fixed the issue once, so I was able to switch from PHP 7.1 to 7.0 without problems. Switch back to anything else gives:

valet use 7.1
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0
PHP Parse error:  syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0
Could not open input file:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20151012/geoip.so' - dlopen(/usr/local/lib/php/pecl/20151012/geoip.so, 9): image not found in Unknown on line 0

Parse error: syntax error, unexpected '' - dlopen(/usr/local/lib/php/' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in Command line code on line 3/cli/valet.php

Looks like your PHP 5.6 version has the same issue, please remove and re-install geoip and check your php.ini when linked to PHP 5.6.

Edit: Going off the assumption that /usr/local/lib/php/pecl/20151012/ is a PECL extension directory for PHP 5.6.

Switching PHP-versions, getting errors, removing PECL-packages, force PHP to relink multiple times it now all seems to work. Thanks for the help.

@luukschakenraad Great! Sorry for the inconvenience the upgrading caused you. I will keep looking into making this less error prone for future valet-plus users. Appreciate the feedback you supplied.

Closing this ticket, glad that you managed to get this issue resolved!

I managed to get all PHP-versions to work, except PHP 7.2. Any tips?

valet use 7.0

[[email protected]] Unlinking
Unlinking /usr/local/Cellar/[email protected]/7.1.18... 345 symlinks removed

[libjpeg] Relinking
[[email protected]] Linking
Linking /usr/local/Cellar/[email protected]/7.0.30... 132 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
        apcu_bc is already installed, skipping...
        apcu_bc is already enabled, skipping...
        geoip is already installed, skipping...
        geoip is already enabled, skipping...
[PECL-CUSTOM] Installing extensions
[[email protected]] Restarting
Valet is now using [email protected]

valet use 7.1

[[email protected]] Unlinking
Unlinking /usr/local/Cellar/[email protected]/7.0.30... 132 symlinks removed

[libjpeg] Relinking
[[email protected]] Linking
Linking /usr/local/Cellar/[email protected]/7.1.18... 132 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
        apcu_bc is already installed, skipping...
        apcu_bc is already enabled, skipping...
        geoip is already installed, skipping...
        geoip is already enabled, skipping...
[PECL-CUSTOM] Installing extensions
[[email protected]] Restarting
Valet is now using [email protected]

valet use 7.2

[[email protected]] Unlinking
Unlinking /usr/local/Cellar/[email protected]/7.1.18... 132 symlinks removed

[libjpeg] Relinking
[[email protected]] Installing
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
[[email protected]] Stopping
PHP Warning:  readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

Warning: readlink(): No such file or directory in /Users/luuk/.composer/vendor/weprovide/valet-plus/cli/Valet/Filesystem.php on line 314

In Brew.php line 274:

  Unable to determine linked PHP.  


use [<phpVersion>]
Was this page helpful?
0 / 5 - 0 ratings