Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lucadg

macrumors newbie
Original poster
Apr 23, 2010
6
0
Hi All,
after hours of searching and trials I give up and ask for help.

I am trying to install Symfony (a php framework) locally and have installed MAMP.

Symfony asks me to run this command

Code:
php lib/vendor/symfony/data/bin/symfony generate:project PROJECT_NAME
but I get

Code:
-bash: /usr/bin/php: Permission denied


now, in /usr/bin/php there is an alias to the location of php which is under MAMP in bin/php5.3/bin and this may be a reason for the error.

Even

Code:
php -v

gives

Code:
-bash: /usr/bin/php: Permission denied

I tried to login as root, but still nothing.

I litterraly read all forums online about this, but I just can't get it.
Thanks for help :)
 
Does PHP work inside MAMP normally? If so then the cause is almost certainly that the executable bit isn't set on the PHP binary. That's easy to fix: change directories to /Applications/MAMP/bin/php5.3/bin and issue this command:
Code:
chmod +x php
Then, try again.
 
now, in /usr/bin/php there is an alias to the location of php which is under MAMP in bin/php5.3/bin and this may be a reason for the error.

Some things to look at (and/or show us):

type -a php
ls -l /usr/bin/php
ls -laL /usr/bin/php
[ -e /usr/bin/php ] && echo linked || echo broken
 
Hi,

Does PHP work inside MAMP normally?
yes, no problem there.

Ok, I tried

Code:
chmod +x php

and then

Code:
php -v

but it still gives

Code:
-bash: /usr/bin/php: Permission denied
after that.

Code:
ls -l /usr/bin/php

gives

-rw-rw-rw-@ 1 lucadegiglio  staff  47636 21 Apr 20:28 /usr/bin/php


ls -laL /usr/bin/php
gives
-rw-rw-rw-@ 1 lucadegiglio  staff  47636 21 Apr 20:28 /usr/bin/php

[ -e /usr/bin/php ] && echo linked || echo broken
gives
linked

How does it look?
The patient has hope? :)

Thanks for your help!
 
sudo chmod +x /usr/bin/php

Though I'm curious why there's an ACL associated with php.. Or is that an immutable flag. rusty cli :(
 
Code:
[COLOR="RoyalBlue"]ls -l /usr/bin/php[/COLOR]
-rw-rw-rw-@ 1 lucadegiglio  staff  47636 21 Apr 20:28 /usr/bin/php


[COLOR="RoyalBlue"]ls -laL /usr/bin/php[/COLOR]
-rw-rw-rw-@ 1 lucadegiglio  staff  47636 21 Apr 20:28 /usr/bin/php

[COLOR="RoyalBlue"][ -e /usr/bin/php ] && echo linked || echo broken[/COLOR]
linked

How does it look?
Not so hot. I'm not seeing that "alias" you mentioned earlier in post #1:
>> now, in /usr/bin/php there is an alias to the location of php which is
>> under MAMP in bin/php5.3/bin and this may be a reason for the error.

/usr/bin/php looks to be an ordinary file... which for some reason you own and the group staff claims membership. Doesn't look right at all... but then again i have Leopard 10.5.8 here:
Code:
[COLOR="Blue"]ls -l /usr/bin/php[/COLOR]
-r-xr-xr-x  1 root  wheel  14795536 Feb  9 03:35 /usr/bin/php
What i expected (after you brought up "alias") was a symlink something like this...
Code:
[COLOR="Blue"]ls -l /usr/bin/ruby[/COLOR]
[COLOR="Red"]l[/COLOR]rwxr-xr-x  1 root  wheel  76 Mar 14  2009 /usr/bin/ruby -> 
../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

[COLOR="Blue"]ls -laL /usr/bin/ruby[/COLOR]
-rwxr-xr-x  1 root  wheel  38304 Jan 28 03:13 /usr/bin/ruby
I.e., "/usr/bin/ruby" is a symlink to a buried executable... but your listing revealed no symlink (or alias either).

Judging by the type, owner, group and perms on your /usr/bin/php ...
i'd say you probably should run a permissions repair and try it again.

--

Though I'm curious why there's an ACL associated with php.. Or is that an immutable flag. rusty cli :(
Interesting point. The ampersand @ is telling us that one or more extended attributes are associated with his php file... but it could also be masking the presence of an ACL (normally indicated with a +).

Perhaps we should look again with
ls -lOe@ /usr/bin/php
 
Interesting point. The ampersand @ is telling us that one or more extended attributes are associated with his php file... but it could also be masking the presence of an ACL (normally indicated with a +).

Perhaps we should look again with
ls -lOe@ /usr/bin/php

THAT'S it, thanks Hal!
 
Hi all,
sorry for delay, I was away!

Code:
luca-de-giglios-macbook:~ lucadegiglio$ sudo chmod +x /usr/bin/php
Password:
luca-de-giglios-macbook:~ lucadegiglio$ php -v
-bash: /usr/bin/php: cannot execute binary file

Not so hot. I'm not seeing that "alias" you mentioned earlier in post #1:
>> now, in /usr/bin/php there is an alias to the location of php which is
>> under MAMP in bin/php5.3/bin and this may be a reason for the error.
here it is
attachment.php


i'd say you probably should run a permissions repair and try it again.
ok, just done. It looks an error was found and fixed
attachment.php


and now the result is

Code:
luca-de-giglios-macbook:~ lucadegiglio$ ls -l /usr/bin/php
-rwxr-xr-x@ 1 root  wheel  47636 21 Apr 20:28 /usr/bin/php

and

Code:
luca-de-giglios-macbook:~ lucadegiglio$ ls -lOe@ /usr/bin/php
-rwxr-xr-x@ 1 root  wheel  - 47636 21 Apr 20:28 /usr/bin/php
	com.apple.FinderInfo	   32 
	com.apple.ResourceFork	47281

but the php -v gives "cannot execute binary file"

Code:
luca-de-giglios-macbook:~ lucadegiglio$ php -v
-bash: /usr/bin/php: cannot execute binary file

what do you reckon? Are we getting closer?

Thanks!!

Luca
 

Attachments

  • Screen shot 2010-04-28 at 13.06.05.jpg
    Screen shot 2010-04-28 at 13.06.05.jpg
    30.8 KB · Views: 2,203
Similar problem

Hey this might be a solution to your problem... I am not sure, but after a lot of searching and stumbling across this thread... it actually solved my problem.

Which was, that I kept getting permission denied while entering php -v and also pear -v and most php commands that I was trying to use within the terminal.

The fix on my part was from wridwzrd89, thanks! I needed to change permissions via chmod and that fixed my dilemma.

I have the same set up as you in regards to MAMP but what I have done is added a $PATH in my .bash_profile to

Code:
PATH=/Applications/MAMP/bin/php5.3/bin:\
/Applications/MAMP/Library/bin:$PATH
export PATH

I think wridwzrd89 post is pretty close to the mark with what I have done. Just to let you know I am not trying to install Symfony framework.

Hope this might help.
 
Hi guyadam

I have the same set up as you in regards to MAMP but what I have done is added a $PATH in my .bash_profile to
I did not have one, so I created it and added the code you suggest.
Still does not work.

Thanks anyway.

I am really stuck now :)
 
and now the result is

Code:
luca-de-giglios-macbook:~ lucadegiglio$ ls -lOe@ /usr/bin/php
-rwxr-xr-x@ 1 root  wheel  - 47636 21 Apr 20:28 /usr/bin/php
	com.apple.FinderInfo	   32 
	com.apple.ResourceFork	47281

Luca
Now that i'm finally running Snow Leopard (new MBP arrived today), here's what i see for php:

ls -lOe@ /usr/bin/php
-rwxr-xr-x 1 root wheel - 29034848 Feb 11 19:27 /usr/bin/php

php -v
PHP 5.3.1 (cli) (built: Feb 11 2010 16:26:40)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

codesign -vvv /usr/bin/php
/usr/bin/php: valid on disk
/usr/bin/php: satisfies its Designated Requirement

md5 /usr/bin/php
MD5 (/usr/bin/php) = 11d44914713606a5b99f9099efd7ac56
All i can say is you have installed something which has modified that file significantly. (note that my php file is 600 times larger than yours). I'm guessing that Finder alias you have there should be a symlink instead...

::shrug::

Try asking in the MAMP forums maybe.
 
I have opened the window and was trying to throw the Mac away, but my fingers accidentaly typed php -v in the terminal and I got

Code:
PHP 5.3.2 (cli) (built: Mar  5 2010 16:45:34) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.0, Copyright (c) 2005-2009, by mOo

....so I guess that the previous actions took effect after a reboot or something...and you guys saved my Mac.
I owe you one!
 
Just FYI the real problem was that you created an alias for PHP rather than a symbolic link. Aliases are Mac-only and don't play nice on the cli. symlinks do.

To fix your /usr/bin/php you can do:
ln -sf /Applications/MAMP/bin/php5.3/bin/php /usr/bin/php

maybe with a sudo in front of it.
 
To fix your /usr/bin/php you can do:
ln -sf /Applications/MAMP/bin/php5.3/bin/php /usr/bin/php

works now...do you suggest to do this anyway?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.