没有 composer.pharr安装不成功怎么办

Yii2 composer 安装失败,求助_百度知道
Yii2 composer 安装失败,求助
提问者采纳
php composer.phar global require &fxp/composer-asset-plugin:1.0.0-beta3& php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0 没问题啊Vendor 安装
来自团队:
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁composer是一个新崛起的PHP的依赖管理工具。官方安装方法见: https://getcomposer.org/doc/00-intro.md#installation-windows 。这里提供不修改PATH环境变量的手动安装方法。 此处假定:
(1)php安装目录为C:/php5.4(2)php安装目录已经加入PATH环境变量(这样就可以在命令行直接输入“php”而不是“C:/php5.4/php.exe”。PATH环境变量修改方法见:http://blog.chinaunix.net/uid--id-3257898.html )(3)composer安装目录为r:/php_phar ———————————–1、前期工作:php在命令行下所使用的php.ini文件,需要打开php_openssl.dll扩展可以通过以下命令行,确定php在命令行下所使用的php.ini文件路径:
php –ini 然后通过以下命令,确定是否打开了php_openssl.dll扩展:
php -i | findstr /I /N “openssl” 如果输出字符串有openssl的信息,表示openssl打开成功;否则,请更改php.ini文件,打开php_openssl.dll扩展。
2、通过浏览器下载如下文件到r:/php_phar,文件名为“composer_installer.phar”: https://getcomposer.org/installer 3、打开cmd命令行,切换到composer安装目录:
cd r:/php_phar 也可以通过我的电脑到达r:/php_phar,然后按住shift后右键,选择“在此处打开命令窗口”
4、输入命令安装:
php composer_installer.phar
5、此时运行“php r:/php_phar/composer.phar -V”,如果显示版本号,表示安装成功。以后可以在其他目录,通过“php r:/php_phar/composer.phar 其他命令行参数”执行composer的其他功能了。
———————————–
问:我看到官方手册、或者其它教程中,就可以直接在windows命令行下输入“composer xxx”执行啊,怎么做到的? 答:需要增加bat文件和修改PATH环境变量。1、增加bat文件。在composer安装目录下增加composer.bat,文件内容为:
@echo off php %~dp0composer.phar %*
这样,就可以通过bat直接运行composer了:
r:/php_phar/composer -V
2、将r:/php_phar加入PATH环境变量,然后重启命令行,就可以达到你的效果了:
———————————–
问:我不想修改PATH环境变量,又想达到简便输入“composer xxx”(甚至php xxx等等)执行,怎么做?
答:可参阅stackoverflow中给出的两个答案,通过“DOSKEY+注册表”、或“DOSKEY + cmd.exe /K参数”完成这种效果。具体见: /questions//aliases-in-windows-command-prompt 。此处仅介绍DOSKEY + cmd.exe /K参数。 (1)保存如下文字到C:/initcmdenv.cmd:
@echo off :: Temporary system path(为当前命令行增加额外的PATH,可随意增加不影响全局系统) set PATH=%PATH%;
:: Commands(增加新的快捷命令,必须为DOSKEY 快捷名称=完整命令) DOSKEY composer=php r:/php_phar/composer.phar $*
::Show something(显示初始化的内容,可以删掉) echo ========DOSKEY========== DOSKEY /macros echo ========END========== (2)新建一个快捷方式。目标位置填入:
%windir%/system32/cmd.exe /K C:/initcmdenv.cmd
(3)愉快地执行composer吧!关于composer安装插件时候提示找不到fxp插件时候的解决办法
关于composer安装插件时候提示找不到fxp插件时候的解决办法
如果你在某个目录使用composer.phar,而且在别的目录页使用了composer,并没有全局安装composer的时候,不同目录之间的可能会互相干扰从而报错
root@tyr:/var/www/html/laravel# composer global require "laravel/installer=~1.1"
Changed current directory to /root/.composer
PHP Fatal error:
Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /root/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272
Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /root/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272
root@tyr:/var/www/html/laravel# ll
导致这个错误的原因是没有全局安装composer.phar并添加到linux的系统环境变量,从而导致composer.phar之间的混乱,要仔细研究composer提高使用效率
For those who still same the problem (I have ubuntu):just remove directory&/home/user/.composer/vendor/fxp
just remove directory /home/user/.composer/vendor/fxp
这就是最终的解决办法。其实是类似于初始化的作用,不是说干扰
/yiisoft/yii2/issues/9794 解决办法
Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。
Hadoop是一个由Apache基金会所开发的分布式系统基础架构。
用户可以在不了解分布式底层细节的情况下,开发分布式程序。充分利用集群的威力进行高速运算和存储。
Hadoop实现了一个分布式文件系统(Hadoop Distributed File System),简称HDFS。HDFS有高容错性的特点,并且设计用来部署在低廉的(low-cost)硬件上;而且它提供高吞吐量(high throughput)来访问应用程序的数据,适合那些有着超大数据集(large data set)的应用程序。HDFS放宽了(relax)POSIX的要求,可以以流的形式访问(streaming access)文件系统中的数据。
Hadoop的框架最核心的设计就是:HDFS和MapReduce。HDFS为海量的数据提供了存储,则MapReduce为海量的数据提供了计算。
产品设计是互联网产品经理的核心能力,一个好的产品经理一定在产品设计方面有扎实的功底,本专题将从互联网产品设计的几个方面谈谈产品设计
随着国内互联网的发展,产品经理岗位需求大幅增加,在国内,从事产品工作的大部分岗位为产品经理,其实现实中,很多从事产品工作的岗位是不能称为产品经理,主要原因是对产品经理的职责不明确,那产品经理的职责有哪些,本专题将详细介绍产品经理的主要职责
IThao123周刊页面导航:
→ 正文内容 PHP Composer 安装与使用
PHP管理依赖(dependency)关系工具 Composer 安装与使用
Composer 是PHP中用来管理依赖(dependency)关系的工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer会帮你安装这些依赖的库文件。
PHP Composer 安装
系统需求:
Composer 需要PHP5.3.2+ 以上的环境来运行。有几个敏感的PHP设置和编译标志也是必需的,但安装程序会发出警告当存在任何不兼容的情况。
比如PHP的扩展的要求是,安装或重新编译php without Cdisable-phar
为了从源地址安装软件包,而不是简单的压缩文件包,您将需要安装软件包的版本控制工具,比如git、svn或hg等。
Composer 是兼容多平台的,其运行适用于Windows,Linux和OSX。
安装失败的错误消息:
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 phar extension is missing.
Install it or recompile php without Cdisable-phar
Your PHP (5.2.9) is too old, you must upgrade to PHP 5.3.2 or higher.
我的本地默认开发环境是PHP 5.2.9,当我尝试在PHP 5.2.9上安装时,提示版本过低,需要升级到PHP 5.3.2 或者更高的版本。
于是我下载XAMPP 1.7.7 usb lite 版本。
E:\USB\Dropbox\phpstorm\php53&E:\USB\xampp_177\php\php.exe -v
PHP 5.3.8 (cli) (built: Aug 23 :20)
Copyright (c)
The PHP Group
Zend Engine v2.3.0, Copyright (c)
Zend Technologies
XAMPP 1.7.7 下的PHP环境是5.3.8。确认我的PHP环境大于等于PHP5.3.2后。
PHP 5.3 安装 Composer
E:\USB\Dropbox\phpstorm\php53&curl -sS https://getcomposer.org/installer | E:\USB\xampp_177\php\php.exe
#!/usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:
The openssl extension is missing, which will reduce the security and stability o
f Composer.
If possible you should enable it or recompile php with Cwith-openssl
Downloading…
Composer successfully installed to: E:\USB\Dropbox\phpstorm\php53\composer.phar
Use it: php composer.phar
我关闭了XAMPP 1.7.7 Apache的SSL模块,所以Composer提示我警告,为了安全因素建议我开启SSL模块。不开启也不影响使用。
安装时的参数 | PHP,一定要更改为真实的PHP环境路径,比如 | E:\USB\xampp_177\php\php.exe
使用Composer为PHP路径 + 命令,在我们安装的环境中,使用方法为:E:\USB\xampp_177\php/php.exe composer.phar 命令。
我安装的环境是在Windows下,如果在Linux下,而PHP 5.3 环境也不在默认PHP命令下时,应该采用 | /usr/php/53/usr/bin/php,例如:
curl -sS https://getcomposer.org/installer | /usr/php/53/usr/bin/php
安装完成后,检查安装版本。
E:\USB\Dropbox\phpstorm\php53&E:\USB\xampp_177\php/php.exe composer.phar -V
Composer version ac3aeb2a68fc81e2d03c71072bef33
检查PHP Composer命令:
E:\USB\Dropbox\phpstorm\php53&E:\USB\xampp_177\php/php.exe composer.phar
/ ____/___ ____ ___ ____ ____ ________ _____
/ __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version ac3aeb2a68fc81e2d03c71072bef33
[options] command [arguments]
-h Display this help message.
-q Do not output any message.
-v Increase verbosity of messages.
-V Display this application version.
Force ANSI output.
Disable ANSI output.
Cno-interaction -n Do not ask any interactive question.
Display timing and memory usage information
Cworking-dir
-d If specified, use the given directory as working directory
Available commands:
Short information about Composer
Create an archive of this composer package
Set config options
create-project
Create new project from a package into given directory.
Shows which packages depend on the given package
Diagnoses the system to identify common errors.
dump-autoload
Dumps the autoloader
dumpautoload
Dumps the autoloader
Displays help for a command
Creates a basic composer.json file in current directory.
Installs the project dependencies from the composer.lock file
if present, or falls back on the composer.json.
Lists commands
Adds required packages to your composer.json and installs the
run-script
Run the scripts defined in composer.json.
Search for packages
self-update
Updates composer.phar to the latest version.
selfupdate
Updates composer.phar to the latest version.
Show information about packages
Show a list of locally modified packages
Updates your dependencies to the latest version according to
composer.json, and updates the composer.lock file.
Validates a composer.json
这样我们在PHP5.3环境下的Composer已经安装完成。
类似的方法我们也可以安装PHP 5.4的环境上。
PHP 5.4 安装 Composer
下载XAMPP 1.8.1 usb lite 版本,将得到PHP5.4.7环境。
E:\USB\Dropbox\phpstorm\php53&E:\USB\xampp_181\php\php.exe -v
PHP 5.4.7 (cli) (built: Sep 12 :31)
Copyright (c)
The PHP Group
Zend Engine v2.4.0, Copyright (c)
Zend Technologies
确定版本高于PHP 5.3.2 后,开始安装:
E:\USB\Dropbox\phpstorm\php54&curl -sS https://getcomposer.org/installer | E:\USB\xampp_181\php\php.exe
#!/usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:
The openssl extension is missing, which will reduce the security and stability o
f Composer.
If possible you should enable it or recompile php with Cwith-openssl
Downloading…
Composer successfully installed to: E:\USB\Dropbox\phpstorm\php54\composer.phar
Use it: php composer.phar
安装完成后,检查安装版本。
E:\USB\Dropbox\phpstorm\php54&E:\USB\xampp_181\php/php.exe composer.phar -V
Composer version ac3aeb2a68fc81e2d03c71072bef33
这样,PHP 5.4 环境下的Composer也安装成功了。
PHP Composer 使用
这里我只简单演示使用PHP Composer安装Symfony框架。
首先大概讲解一下命令的标准格式:
php composer.phar create-project symfony/framework-standard-edition path/ 2.2.1
第一个参数PHP为本地PHP开发环境,指向PHP运行命令。
第二个参数,为composer.phar方式下载。
第三个参数,为动作命令,例如create-project,目的是为了创建一个新的项目从一个软件包到指定目录。
第四个参数,为本地安装的目录。
第五个参数,为安装软件包的版本。
根据上述我们在PHP5.4环境下安装的Composer,我们的安装命令为:
E:\USB\Dropbox\phpstorm\php54&E:\USB\xampp_181\php/php.exe composer.phar create-project symfony/framework-standard-edition E:\USB\xampp_181\htdocs\Symfony 2.2.1
安装结果:
Installing symfony/framework-standard-edition (v2.2.1)
C Installing symfony/framework-standard-edition (v2.2.1)
Downloading: 100%
Created project in E:\USB\xampp_181\htdocs\Symfony
Loading composer repositories with package information
Installing dependencies from lock file
C Installing doctrine/lexer (v1.0)
Downloading: 100%
C Installing doctrine/annotations (v1.1)
Downloading: 100%
C Installing doctrine/cache (v1.0)
Downloading: 100%
C Installing doctrine/collections (v1.1)
Downloading: 100%
C Installing twig/twig (v1.12.2)
Downloading: 100%
C Installing psr/log (1.0.0)
Downloading: 100%
C Installing doctrine/inflector (v1.0)
Downloading: 100%
C Installing doctrine/common (2.4.0-RC1)
Downloading: 100%
C Installing symfony/symfony (v2.2.1)
Downloading: 100%
C Installing jdorn/sql-formatter (v1.2.0)
Downloading: 100%
C Installing doctrine/dbal (2.3.3)
Downloading: 100%
C Installing doctrine/doctrine-bundle (v1.2.0-beta1)
Downloading: 100%
C Installing doctrine/orm (2.3.3)
Downloading: 100%
C Installing jms/cg (1.0.0)
Downloading: 100%
C Installing phpoption/phpoption (1.2.0)
Downloading: 100%
C Installing jms/parser-lib (1.0.0)
Downloading: 100%
C Installing jms/metadata (1.3.0)
Downloading: 100%
C Installing jms/aop-bundle (1.0.0)
Downloading: 100%
C Installing jms/di-extra-bundle (1.3.0)
Downloading: 100%
C Installing jms/security-extra-bundle (1.4.0)
Downloading: 100%
C Installing sensio/distribution-bundle (v2.2.1)
Downloading: 100%
C Installing sensio/framework-extra-bundle (v2.2.1)
Downloading: 100%
C Installing sensio/generator-bundle (v2.2.1)
Downloading: 100%
C Installing kriswallsmith/assetic (v1.1.0-alpha4)
Downloading: 100%
C Installing symfony/assetic-bundle (v2.1.2)
Downloading: 100%
C Installing monolog/monolog (1.4.1)
Downloading: 100%
C Installing symfony/monolog-bundle (v2.2.0)
Downloading: 100%
C Installing swiftmailer/swiftmailer (v4.3.0)
Downloading: 100%
C Installing symfony/swiftmailer-bundle (v2.2.0)
Downloading: 100%
C Installing twig/extensions (v1.0.0)
Downloading: 100%
kriswallsmith/assetic suggests installing leafo/lessphp (Assetic provides the integration with the lessphp LESS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp (Assetic provides the integration with the scssphp SCSS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp-compass (Assetic provides the integration with the SCSS compass plugin)
kriswallsmith/assetic suggests installing ptachoire/cssembed (Assetic provides the integration with phpcssembed to embed data uris)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mlehner/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
Generating autoload files
Clearing the cache for the dev environment with debug true
Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for Acme\DemoBundle into web/bundles/acmedemo
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
从命令行结果,我们看到了整个Symfony框架的安装过程与结果。
PHP Composer 定义依赖关系
Composer在使用时会自动寻找composer.json这个文件。 composer.json将用来定义整个项目的依赖包。例如:
"require": {
"monolog/monolog": "1.2.*"
依赖包简单的说明,我们的项目需要一些从1.2开始的任何版本的monolog/monolog包。
Composer是PHP中的一个依赖关系管理工具。通过Composer我们可以在发布软件时节省大量的文件数目和控制依赖包的版本。
PHP Composer 项目
Composer 项目官方:
Composer Github项目:
PHP Composer软件包列表:
您可能感兴趣的文章:
上一篇:下一篇:
最 近 更 新
热 点 排 行
12345678910}

我要回帖

更多关于 composer.phar 安装 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信