我无法在mac os x上安装composer

时间:2014-03-19 00:45:13

标签: php macos composer-php macports php-openssl

按照此页面的说明(下面的链接),我仍然无法安装作曲家,我不知道我在这里失败了。有没有好眼睛发现我的错误?我非常接近,我能感觉到它,但没有运气,这可能是我在这里做的一个简单错误......请帮忙!

https://getcomposer.org/download/

第1步:

curl -sS https://getcomposer.org/installer | php

控制台响应:

#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl

第2步:

<?php phpinfo(); ?>

响应:

Apache Version
Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.1e DAV/2 PHP/5.4.15

Additional .ini files parsed
/opt/local/var/db/php54/openssl.ini,

OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.1e 11 Feb 2013
OpenSSL Header Version  OpenSSL 1.0.1e 11 Feb 2013

第3步:

cd /opt/local/var/db
ls -al

响应:

drwxr-xr-x  25 root    admin    850  6 Jan 23:52 php5
drwxr-xr-x   4 root    admin    136 29 Dec 20:39 php53
drwxr-xr-x  27 root    admin    918 28 Jan 12:34 php54

第4步:

cd php54
ls -al

响应:

......
-rw-r--r--   1 root  admin  237 10 May  2013 openssl.ini
......

第5步:

vim openssl.ini

响应:

; Do not edit this file; it is automatically generated by MacPorts. Any changes
; you make will be lost if you upgrade, uninstall or deactivate php54-openssl.
; To configure php54, edit /opt/local/etc/php54/php.ini.
extension=openssl.so

第5步:(只是仔细检查)

sudo port install php54-openssl

响应:

--->  Computing dependencies for php54-openssl
--->  Cleaning php54-openssl
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

第6步:

sudo /opt/local/apache2/bin/apachectl -k restart

第7步:

curl -sS https://getcomposer.org/installer | php

响应:

与第1步一样

第8步:

curl -sS https://getcomposer.org/installer | php54

响应:

#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Could not create file /opt/local/var/db/php54/composer.phar: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
Download failed: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
fwrite() expects parameter 1 to be resource, boolean given
Downloading...
Could not create file /opt/local/var/db/php54/composer.phar: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
Download failed: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
fwrite() expects parameter 1 to be resource, boolean given
Downloading...
Could not create file /opt/local/var/db/php54/composer.phar: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
Download failed: fopen(/opt/local/var/db/php54/composer.phar): failed to open stream: Permission denied
fwrite() expects parameter 1 to be resource, boolean given
The download failed repeatedly, aborting.

第9步:

sudo curl -sS https://getcomposer.org/installer | php54

响应:

与第8步一样

2 个答案:

答案 0 :(得分:8)

第9步:

curl -sS https://getcomposer.org/installer | sudo php54

答案 1 :(得分:1)

mkdir -p / usr / local / bin

curl -sS https://getcomposer.org/installer | sudo php - --install-dir = / usr / local / bin --filename = composer --version = 1.0.0-alpha11