This repository has been archived by the owner. It is now read-only.

Can not install extension with pecl #1039

Closed
wangchen opened this Issue Mar 14, 2014 · 27 comments

Comments

@wangchen

wangchen commented Mar 14, 2014

OS: OS X 10.9
PHP: 5.4

When i install any extension with pecl, i got:

Fatal error: Call to a member function getFilelist() on a non-object in /usr/local/Cellar/php55/5.5.10/lib/php/PEAR/Command/Install.php on line 742
@wangchen

This comment has been minimized.

Show comment
Hide comment
@wangchen

wangchen Mar 15, 2014

Fixed after i try install other extensions with pear.

wangchen commented Mar 15, 2014

Fixed after i try install other extensions with pear.

@wangchen wangchen closed this Mar 15, 2014

@WyleshaRachell

This comment has been minimized.

Show comment
Hide comment
@WyleshaRachell

WyleshaRachell Mar 20, 2014

What other extensions did you install. I am having the same issue.

Thanks!

WyleshaRachell commented Mar 20, 2014

What other extensions did you install. I am having the same issue.

Thanks!

@lucasmichot

This comment has been minimized.

Show comment
Hide comment
@lucasmichot

lucasmichot Mar 23, 2014

Contributor

@WyleshaRachell , make sure to follow pear configuration as explained at the end of the php5xinstallation:

# Replace x with the wished php version (3, 4, 5 or 6)
brew info php5x 

For php55, you should do the following :

chmod -R ug+w /usr/local/Cellar/php55/5.5.10/lib/php
pear config-set php_ini /usr/local/etc/php/5.5/php.ini
Contributor

lucasmichot commented Mar 23, 2014

@WyleshaRachell , make sure to follow pear configuration as explained at the end of the php5xinstallation:

# Replace x with the wished php version (3, 4, 5 or 6)
brew info php5x 

For php55, you should do the following :

chmod -R ug+w /usr/local/Cellar/php55/5.5.10/lib/php
pear config-set php_ini /usr/local/etc/php/5.5/php.ini
@alanthing

This comment has been minimized.

Show comment
Hide comment
@alanthing

alanthing Apr 24, 2014

Contributor

Here's how I solved this issue with php53, I'm sure if you sub that out for 54/55/56 it'll have the same effect:

touch $(brew --prefix php53)/lib/php/.lock && chmod 0644 $(brew --prefix php53)/lib/php/.lock

After doing so, I was able to pecl install zendopcache-beta without error, whereas before I had the same error as the OP

Contributor

alanthing commented Apr 24, 2014

Here's how I solved this issue with php53, I'm sure if you sub that out for 54/55/56 it'll have the same effect:

touch $(brew --prefix php53)/lib/php/.lock && chmod 0644 $(brew --prefix php53)/lib/php/.lock

After doing so, I was able to pecl install zendopcache-beta without error, whereas before I had the same error as the OP

@d1rk

This comment has been minimized.

Show comment
Hide comment
@d1rk

d1rk May 21, 2014

The solution from @alanthing worked for me. Thank you very much.

d1rk commented May 21, 2014

The solution from @alanthing worked for me. Thank you very much.

@WyleshaRachell

This comment has been minimized.

Show comment
Hide comment
@WyleshaRachell

WyleshaRachell Jun 16, 2014

@lucasmichot Thanks that worked for me! Thank You! =)

WyleshaRachell commented Jun 16, 2014

@lucasmichot Thanks that worked for me! Thank You! =)

@josegonzalez

This comment has been minimized.

Show comment
Hide comment
@josegonzalez

josegonzalez Jun 16, 2014

Contributor

@lucasmichot can we do that in a sort of "after" step for users automatically? I thought we did.

Contributor

josegonzalez commented Jun 16, 2014

@lucasmichot can we do that in a sort of "after" step for users automatically? I thought we did.

@lucasmichot

This comment has been minimized.

Show comment
Hide comment
@lucasmichot

lucasmichot Jun 16, 2014

Contributor

Hello @josegonzalez , I don't think so (not yet !).
But I was thinking about it, node formula has a post_install feature (https://github.com/Homebrew/homebrew/blob/master/Library/Formula/node.rb#L47), I think I can add this kind of feature

Contributor

lucasmichot commented Jun 16, 2014

Hello @josegonzalez , I don't think so (not yet !).
But I was thinking about it, node formula has a post_install feature (https://github.com/Homebrew/homebrew/blob/master/Library/Formula/node.rb#L47), I think I can add this kind of feature

@josegonzalez

This comment has been minimized.

Show comment
Hide comment
@josegonzalez

josegonzalez Jun 16, 2014

Contributor

Perfect, I like that a lot.

Contributor

josegonzalez commented Jun 16, 2014

Perfect, I like that a lot.

@lucasmichot

This comment has been minimized.

Show comment
Hide comment
@lucasmichot

lucasmichot Jun 16, 2014

Contributor

Go for some code !

Contributor

lucasmichot commented Jun 16, 2014

Go for some code !

@zakiirjuman

This comment has been minimized.

Show comment
Hide comment
@zakiirjuman

zakiirjuman Aug 10, 2014

@alanthing That worked for me too! Thank you!

zakiirjuman commented Aug 10, 2014

@alanthing That worked for me too! Thank you!

@dmuralik

This comment has been minimized.

Show comment
Hide comment
@dmuralik

dmuralik Aug 25, 2014

setting the right permission and then calling install again worked for me:

(change the php version accordingly)
chmod -R ug+w /usr/local/Cellar/php55/5.5.10/lib/php

dmuralik commented Aug 25, 2014

setting the right permission and then calling install again worked for me:

(change the php version accordingly)
chmod -R ug+w /usr/local/Cellar/php55/5.5.10/lib/php

@konamax123

This comment has been minimized.

Show comment
Hide comment
@konamax123

konamax123 Oct 28, 2014

@alanthing Worked for me! Thanks

konamax123 commented Oct 28, 2014

@alanthing Worked for me! Thanks

@cy-shintaro-kurachi

This comment has been minimized.

Show comment
Hide comment
@cy-shintaro-kurachi

cy-shintaro-kurachi commented Nov 13, 2014

Thanks !!!!!!

@jbeduya

This comment has been minimized.

Show comment
Hide comment
@jbeduya

jbeduya Dec 9, 2014

@alanthing Worked for me too. Many thanks!

jbeduya commented Dec 9, 2014

@alanthing Worked for me too. Many thanks!

@davidtran

This comment has been minimized.

Show comment
Hide comment
@davidtran

davidtran Dec 19, 2014

@lucasmichot thank you, it works for me

davidtran commented Dec 19, 2014

@lucasmichot thank you, it works for me

@KotieSmit

This comment has been minimized.

Show comment
Hide comment
@KotieSmit

KotieSmit Feb 26, 2015

@lucasmichot's Solution worked for me. Thanks!!

KotieSmit commented Feb 26, 2015

@lucasmichot's Solution worked for me. Thanks!!

@JoyceBabu

This comment has been minimized.

Show comment
Hide comment
@JoyceBabu

JoyceBabu commented Apr 16, 2015

Thank you @lucasmichot.

@rsweetland

This comment has been minimized.

Show comment
Hide comment
@rsweetland

rsweetland Sep 20, 2015

Simply running with sudo worked for me. Ex: sudo pecl install mailparse

rsweetland commented Sep 20, 2015

Simply running with sudo worked for me. Ex: sudo pecl install mailparse

@JoyceBabu

This comment has been minimized.

Show comment
Hide comment
@JoyceBabu

JoyceBabu Sep 20, 2015

@rsweetland Using sudo is usually discouraged.

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md

Why does Homebrew say sudo is bad?

tl;dr Sudo is dangerous, and you installed TextMate.app without sudo anyway.

Homebrew is designed to work without using sudo. You can decide to use it but we strongly recommend not to do so. If you have used sudo and run into a bug then it is likely to be the cause. Please don’t file a bug report unless you can reproduce it after reinstalling Homebrew from scratch without using sudo.

You should only ever sudo a tool you trust. Of course, you can trust Homebrew ;) But do you trust the multi-megabyte Makefile that Homebrew runs? Developers often understand C++ far better than they understand make syntax. It’s too high a risk to sudo such stuff. It could break your base system, or alter it subtly.

And indeed, we’ve seen some build scripts try to modify /usr even when the prefix was specified as something else entirely.

Did you chown root /Applications/TextMate.app? Probably not. So is it that important to chown root wget?

If you need to run Homebrew in a multi-user environment, consider creating a separate user account especially for use of Homebrew.

JoyceBabu commented Sep 20, 2015

@rsweetland Using sudo is usually discouraged.

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md

Why does Homebrew say sudo is bad?

tl;dr Sudo is dangerous, and you installed TextMate.app without sudo anyway.

Homebrew is designed to work without using sudo. You can decide to use it but we strongly recommend not to do so. If you have used sudo and run into a bug then it is likely to be the cause. Please don’t file a bug report unless you can reproduce it after reinstalling Homebrew from scratch without using sudo.

You should only ever sudo a tool you trust. Of course, you can trust Homebrew ;) But do you trust the multi-megabyte Makefile that Homebrew runs? Developers often understand C++ far better than they understand make syntax. It’s too high a risk to sudo such stuff. It could break your base system, or alter it subtly.

And indeed, we’ve seen some build scripts try to modify /usr even when the prefix was specified as something else entirely.

Did you chown root /Applications/TextMate.app? Probably not. So is it that important to chown root wget?

If you need to run Homebrew in a multi-user environment, consider creating a separate user account especially for use of Homebrew.

@rsweetland

This comment has been minimized.

Show comment
Hide comment
@rsweetland

rsweetland Sep 21, 2015

Thanks, @JoyceBabu. Good to know regarding the use of sudo on Homebrew-specific packages.

On OSX (without brew) and Ubuntu, installing PECL extensions with sudo seems to be common parlance. And, of course any escalation of privileges exposes the system to some amount of additional risk.

We'll see what Homebrew has to say about my sudo-installed extension during my next install / update. So far so good.

rsweetland commented Sep 21, 2015

Thanks, @JoyceBabu. Good to know regarding the use of sudo on Homebrew-specific packages.

On OSX (without brew) and Ubuntu, installing PECL extensions with sudo seems to be common parlance. And, of course any escalation of privileges exposes the system to some amount of additional risk.

We'll see what Homebrew has to say about my sudo-installed extension during my next install / update. So far so good.

@sobolevn

This comment has been minimized.

Show comment
Hide comment
@sobolevn

sobolevn Oct 21, 2015

@lucasmichot thanks, this helped.

sobolevn commented Oct 21, 2015

@lucasmichot thanks, this helped.

@adrianbj

This comment has been minimized.

Show comment
Hide comment
@adrianbj

adrianbj Mar 6, 2016

@alanthing - thanks - just worked for 5.6!

adrianbj commented Mar 6, 2016

@alanthing - thanks - just worked for 5.6!

@alanthing

This comment has been minimized.

Show comment
Hide comment
@alanthing

alanthing Mar 7, 2016

Contributor

@adrianbj glad to hear!

Contributor

alanthing commented Mar 7, 2016

@adrianbj glad to hear!

@kenorb

This comment has been minimized.

Show comment
Hide comment
@kenorb

kenorb Apr 19, 2016

The same happened for PHP 5.6, above solution worked, so the fix is to run:

$ chmod -R ug+w /usr/local/Cellar/php*

then installing pecl extension worked fine:

$ pecl install channel://pecl.php.net/xhprof-0.9.4

Ideally the permission should include only folder where extension is trying to write to, most likely it's /usr/local/Cellar/php56/5.6.*/lib/php/extensions folder where it's trying to copy its compiled .so module (if doesn't exist, create one).

The fix for this error can be found in: pear/pear-core/pull/50

kenorb commented Apr 19, 2016

The same happened for PHP 5.6, above solution worked, so the fix is to run:

$ chmod -R ug+w /usr/local/Cellar/php*

then installing pecl extension worked fine:

$ pecl install channel://pecl.php.net/xhprof-0.9.4

Ideally the permission should include only folder where extension is trying to write to, most likely it's /usr/local/Cellar/php56/5.6.*/lib/php/extensions folder where it's trying to copy its compiled .so module (if doesn't exist, create one).

The fix for this error can be found in: pear/pear-core/pull/50

@toby5box

This comment has been minimized.

Show comment
Hide comment
@toby5box

toby5box Dec 5, 2016

With php56, @alanthing 's solution worked for me; @lucasmichot 's did not (sorry Lucas!)

chmod 644 $(brew --prefix php56)/lib/php/.lock

The operation I was attempting:

pecl install memcache

There must be a better way of reporting this error... one that doesn't involve Google...

toby5box commented Dec 5, 2016

With php56, @alanthing 's solution worked for me; @lucasmichot 's did not (sorry Lucas!)

chmod 644 $(brew --prefix php56)/lib/php/.lock

The operation I was attempting:

pecl install memcache

There must be a better way of reporting this error... one that doesn't involve Google...

@Synchro

This comment has been minimized.

Show comment
Hide comment
@Synchro

Synchro Feb 20, 2017

Contributor

I still get this every time I update PHP - all the way through 5.6, 7.0, 7.1.2 today, and I keep ending up back on this page...

Contributor

Synchro commented Feb 20, 2017

I still get this every time I update PHP - all the way through 5.6, 7.0, 7.1.2 today, and I keep ending up back on this page...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.