1 查询环境变量
[root@iZ25uso7yliZ ~] # echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/www/wdlinux/mysql/bin:/root/bin
Export命令定义变量【只对当前shell(BASH)有效(临时的)】
[root@iZ25uso7yliZ bin] #export PATH=/www/wdlinux/apache_php-5.5.9/bin:$PATH
[root@iZ25uso7yliZ bin] #php -v
PHP 5.5.9 (cli) (built: Jan28 2016 10:25:45)
Copyright (c) 1997-2014 ThePHP Group
Zend Engine v2.5.0,Copyright (c) 1998-2014 Zend Technologies
2 /etc./profile环境变量对所有用户生效(永久的)
PATH=/www/wdlinux/apache_php-5.5.9/bin:$PATH
export PATH
Root@iZ25uso7yliZ~]# vim /etc./profile
#Current threshold for system reserved uid/gads is 200
#You could check uidgid reservation validity in
#/user/share/doc/setup-*/uidgid file
......
PATH=/www/wdlinux/apache_php-5.5.9/bin:$PATH
export PATH
"/etc./profile"82L, 1856C 82,2 Bot
[root@iZ25uso7yliZ~]# source /etc./profile
[root@iZ25uso7yliZapache_php-5.5.9]# cd /
[root@iZ25uso7yliZ/]# php -v
PHP5.5.9 (cli) (built: Jan 28 2016 10:25:45)
Copyright(c) 1997-2014 The PHP Group
ZendEngine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
3. 在用户目录下的 .bash_profile文件中增加变量【对单一用户生效(永久的)】
PATH=/www/wdlinux/apache_php-5.5.9/bin:$PATH
export PATH
root@iZ25uso7yliZ~] # vim ~/.bash_profile
#.bash_profile
#Get the aliases and functions
if[ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#User specific environment and startup programs
PATH=$PATH:$HOME/bin
PATH=/www/wdlinux/apache_php-5.5.9/bin:$PATH
exportPATH
"~/.bash_profile"12L, 176C
4.执行curl 安装 composer , 如下
root@iZ25uso7yliZ~]curl -sS http://install.phpcomposer.com/installer | php
#!/usr/bin/envphp
Allsettings correct for using Composer
Downloading...
Composersuccessfully installed to: /root/composer.phar
Useit: php composer.phar
[root@iZ25uso7yliZ~]# mv composer.phar /usr/local/bin/composer
[root@iZ25uso7yliZ~]# composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / /__ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
//___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_//_/ /_/ .___/\____/____/\___/_/
/_/
Composerversion 1.0-dev (cd21505c8d58499a9b4d38573881cfec49c51ffd) 2016-01-27 13:04:22
5修改 laravel安装环境,如下
拷贝 .composer/ 的 vendor 目录到 /usr/local/bin
[root@iZ25uso7yliZ~]# composer global require "laravel/installer"
[root@iZ25uso7yliZ~]# cd ~/.composer/
[root@iZ25uso7yliZ.composer]# ls
cache composer.json composer.lock vendor
[root@iZ25uso7yliZ.composer]# cp -R vendor /usr/local/bin
[root@iZ25uso7yliZ.composer]# cd vendor/bin
[root@iZ25uso7yliZbin]# cp laravel /usr/local/bin
[root@iZ25uso7yliZ~]# vim /etc./profile
PATH=/usr/local/vendor/bin:$PATH
export PATH
/etc./profile" 86L, 1892C
[root@iZ25uso7yliZ~]# source /etc./profile
6查询laravel 命令
[root@iZ25uso7yliZ~]# laravel
Laravel Installerversion .3.1
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask anyinteractive question
-v|vv|vvv, --verbose Increase theverbosity of messages: 1 for normal output, 2 for more verbose output and 3 fordebug
Available commands:
help Displays help for a command
list Lists commands
new Create a new Laravel application.
[root@iZ25uso7yliZ ~]#