<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[实践OK]Linux下 php环境安装、配置composer，使用composer安装laravel/lumen、zan等框架,写一个读取数据库的。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 10 Jan 2017 15:17:33 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	/usr/bin/env: PHP: No such file or directory报错<br/>su www<br/><br/>[root@VM-0-15-centos ~]# curl -sS https://getcomposer.org/installer &#124; php<br/><br/>#把composer.phar转移之bin目录以便全局使用<br/>[root@VM-0-15-centos ~]# mv composer.phar /usr/local/bin/composer<br/>#展示版本信息说明成功<br/>[root@VM-0-15-centos ~]# composer -v<br/>如果出现这个提示，是因为composer不建议root账号运行，可以输入y，或者切换账号<br/><br/>Do not run Composer as root/super user! See https://getcomposer.org/root for details<br/>Continue as root/super user [yes]? <br/><br/>sudo -u www -H/usr/local/composer/bin/composer config repo.packagist composer https://mirrors.aliyun.com/composer/<br/>[ErrorException]<br/>&nbsp;&nbsp;touch(): Unable to create file /home/www/.config/composer/config.json because No such file or directory&nbsp;&nbsp;<br/><br/>#composer clear-cache<br/>Do not run Composer as root/super user! See https://getcomposer.org/root for details<br/>Continue as root/super user [yes]? yes<br/>Cache directory does not exist (cache-vcs-dir): <br/>Cache directory does not exist (cache-repo-dir): <br/>Cache directory does not exist (cache-files-dir): <br/>Clearing cache (cache-dir): /root/.cache/composer<br/>如果是其它用户就是在它的家目录下面建立配置文件。<br/><br/>[root@nexus-repo-10-10-0-109:/data/www/l.levoo.com]<br/>#sudo -u www -H /usr/local/composer/composer update<br/>Loading composer repositories with package information<br/><br/>[root@nexus-repo-10-10-0-109:/data/www/l.levoo.com]<br/>#sudo -u www -H /usr/local/composer/composer update<br/>......<br/>Package operations: 41 installs, 14 updates, 38 removals<br/>&nbsp;&nbsp;&nbsp;&nbsp;Failed to download dragonmantank/cron-expression from dist: The zip extension is missing and unzip/7z commands cannot be called as proc_open is disabled, skipping.<br/>Your command-line PHP is using multiple ini files. Run `php --ini` to show them.<br/>&nbsp;&nbsp;&nbsp;&nbsp;Now trying to download from source<br/><br/>PHP的一些安全函数禁用了，打开就成功了：<br/>&nbsp;&nbsp;- Upgrading easyswoole/task (1.0.5 =&gt; 1.1.2): Extracting archive<br/>&nbsp;&nbsp;- Upgrading easyswoole/log (1.0.3 =&gt; 1.1.1): Extracting archive<br/>Generating autoload files<br/>28 packages you are using are looking for funding.<br/>Use the `composer fund` command to find out more!<br/><br/><br/><br/>然后执行compser up<br/>或者备份composer.lock<br/>==========================================================================<br/><br/>composer config -g repo.packagist composer https://packagist.phpcomposer.com #换国内镜像URL地址。<br/>composer是一个可执行命令，你在一个空目录下写一个composer.json<br/>然后执行composer update,就能生成。<br/>====================两步：软链接composer/PATH/下载autoloader===========================<br/>软链接加PATH:<br/><textarea name="code" class="php" rows="15" cols="100">
cat &gt; /etc/profile.d/composer.sh &lt;&lt;EOF
PATH=&#92;$PATH:/usr/local/composer
export PATH
EOF
</textarea><br/><br/>easy swoole 3.0.9 官方并不是最新的，换换阿里云镜像：<br/>全局替换：<br/>composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/<br/>composer clear-cache # 此步奏选泽性操作，清除所有 package 缓存。<br/> composer clear-cache<br/>Cache directory does not exist (cache-vcs-dir): <br/>Clearing cache (cache-repo-dir): /data/www/.cache/composer/repo<br/>Clearing cache (cache-files-dir): /data/www/.cache/composer/files<br/>Clearing cache (cache-dir): /data/www/.cache/composer<br/><br/>当前项目替换： （注意：不让root用户运行，用www用户）<br/>cd 项目目录<br/>composer config repo.packagist composer https://mirrors.aliyun.com/composer/<br/><br/><br/>不重新开终端不会生效，则可直接导入变量：<br/>source /etc/profile.d/composer.sh <br/><br/><br/>cd /usr/local/kafka-php<br/>cat composer.json <br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;require&quot;: &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;nmred/kafka-php&quot;: &quot;0.2.*&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&#125;<br/><br/>composer update<br/>Loading composer repositories with package information<br/>Updating dependencies (including require-dev)<br/>Package operations: 3 installs, 0 updates, 0 removals<br/>&nbsp;&nbsp;- Installing amphp/amp (v1.2.2): Downloading (100%)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing psr/log (1.0.2): Downloading (100%)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing nmred/kafka-php (v0.2.0.8): Downloading (100%)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>Writing lock file<br/>Generating autoload files<br/><br/>cd /usr/local/kafka-php<br/>composer.json&nbsp;&nbsp;composer.lock&nbsp;&nbsp;vendor<br/>目的是看下同事所说的Kafka死光了，kafka-php会退出的问题：<br/>https://github.com/weiboad/kafka-php<br/><br/>===========================================================================<br/><br/>cd /usr/local/composer&nbsp;&nbsp;，sudo -u www -H composer.phar install ，会去读取：/usr/local/composer/composer.json文件。<br/>chown -R www.www /data/htdocs/sd.levoo.com #否则会报：/data/htdocs/sd.levoo.com/vendor does not exist and could not be created. <br/>sudo -u www -H composer.phar install <br/><textarea name="code" class="php" rows="15" cols="100">
php -r &quot;copy(&#039;https://getcomposer.org/installer&#039;, &#039;composer-setup.php&#039;);&quot;
php -r &quot;if (hash_file(&#039;SHA384&#039;, &#039;composer-setup.php&#039;) === &#039;669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410&#039;) &#123; echo &#039;Installer verified&#039;; &#125; else &#123; echo &#039;Installer corrupt&#039;; unlink(&#039;composer-setup.php&#039;); &#125; echo PHP_EOL;&quot;
php composer-setup.php
php -r &quot;unlink(&#039;composer-setup.php&#039;);&quot;

 php composer.phar
</textarea><br/>实践如下：<br/><br/><textarea name="code" class="php" rows="15" cols="100">
[root@a composer]# php -r &quot;copy(&#039;https://getcomposer.org/installer&#039;, &#039;composer-setup.php&#039;);&quot;
[root@a composer]# php -r &quot;if (hash_file(&#039;SHA384&#039;, &#039;composer-setup.php&#039;) === &#039;55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30&#039;) &#123; echo &#039;Installer verified&#039;; &#125; else &#123; echo &#039;Installer corrupt&#039;; unlink(&#039;composer-setup.php&#039;); &#125; echo PHP_EOL;&quot;
Installer verified
[root@a composer]# php composer-setup.php
Downloading...

Composer (version 1.3.1) successfully installed to: /usr/local/composer/composer.phar
Use it: php composer.phar

Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.
Recompile it without this flag if possible


php -r &quot;unlink(&#039;composer-setup.php&#039;);&quot;

</textarea><br/>vi /etc/sudoers<br/>Defaults&nbsp;&nbsp;&nbsp;&nbsp;secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/composer:/usr/local/php/bin<br/><br/><br/>#sudo -u www -H composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;[ErrorException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;touch(): Unable to create file /home/www/.composer/config.json because No such file or directory&nbsp;&nbsp;<br/><br/>#mkdir&nbsp;&nbsp;/home/www<br/>#chown www.www /home/www<br/>#chmod 755 /home/www<br/>#sudo -u www -H composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com<br/><br/><br/>#sudo -u www -H composer.phar install <br/>Composer could not find a composer.json file in /usr/local/composer<br/>To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ &quot;Getting Started&quot; section<br/><br/>建立composer.json如下，可以根据需要添加你所依赖的库，但下面一定得包含在内，autoload必须要指定app和test的目录不得省略。<br/><br/>&#123;<br/>&nbsp;&nbsp;&quot;require&quot;: &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&quot;tmtbe/swooledistributed&quot;:&quot;&gt;2.0.0&quot;<br/>&nbsp;&nbsp;&#125;,<br/> &quot;autoload&quot;: &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&quot;psr-4&quot;: &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;app&#92;&#92;&quot;: &quot;src/app&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;test&#92;&#92;&quot;: &quot;src/test&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&#125;<br/>&#125;<br/>/usr/local/composer/composer.json<br/>运行:<br/>#sudo -u www -H composer.phar install<br/>Loading composer repositories with package information<br/>Updating dependencies (including require-dev)<br/>&nbsp;&nbsp;[RuntimeException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;/usr/local/composer/vendor does not exist and could not be created.<br/><br/>&nbsp;&nbsp;[RuntimeException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;/usr/local/composer/vendor/symfony/intl does not exist and could not be created<br/><br/>&nbsp;&nbsp;- Installing symfony/intl (v3.3.8): <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;[Symfony&#92;Component&#92;Process&#92;Exception&#92;RuntimeException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;The Process class relies on proc_open, which is not available on your PHP installation.&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>PHP需有proc_open，得从PHP的php.ini里给去掉：<br/>; disable_functions = chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_<br/>restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket<br/><br/>#sudo -u www -H composer.phar install<br/>Composer could not find a composer.json file in /usr/local/php/etc<br/>To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ &quot;Getting Started&quot; section<br/>得cd到：/usr/local/composer 里，再执行：sudo -u www -H composer.phar install<br/>#sudo -u www -H composer.phar install<br/>&nbsp;&nbsp;[ErrorException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;proc_get_status() has been disabled for security reasons&nbsp;&nbsp; 和上面一样：得从PHP的php.ini里给去掉。<br/>&nbsp;&nbsp;[RuntimeException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;Could not delete /usr/local/composer/vendor/symfony/intl: <br/>&nbsp;&nbsp;chown -R www.www&nbsp;&nbsp;/usr/local/composer/vendor<br/>&nbsp;&nbsp;[ErrorException]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;file_put_contents(./composer.lock): failed to open stream: Permission denied&nbsp;&nbsp; #写入/usr/local/composer/composer.lock权限不够。<br/>[root@gitlab-jenkins_php-redis_123.57.252.183:/usr/local]<br/>#chown www.www composer<br/>#sudo -u www -H composer.phar install<br/>Loading composer repositories with package information<br/>Updating dependencies (including require-dev)<br/>Nothing to install or update<br/>Writing lock file<br/>Generating autoload files<br/>。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。<br/><br/><br/>From:https://getcomposer.org/download/<br/>http://blog.csdn.net/yoywow/article/details/52074512<br/><br/>二、使用composer安装laravel/lumen:<br/>遇到问题：<br/>修改 composer 的全局配置文件（推荐方式）<br/><br/>打开命令行窗口（windows用户）或控制台（Linux、Mac 用户）并执行如下命令：<br/>[root@a composer]# chtdocs <br/>[root@a htdocs]# cd lumen.levoo.com/<br/>[root@a lumen.levoo.com]# /usr/local/composer/composer.phar global require &quot;laravel/lumen-installer&quot;<br/>Changed current directory to /root/.config/composer<br/>Do not run Composer as root/super user! See https://getcomposer.org/root for details<br/>compser 执行命令提示do not run composer as root/super !<br/>这个是因为composer为了防止非法脚本在root下执行，解决办法随便切换到非root用户即可<br/>su www<br/>mkdir -p /home/www/.cache<br/>chown -R www:www /home/www/.cache<br/><br/>composer require easyswoole/hot-reload<br/>Cannot create cache directory /home/www/.cache/composer/repo/https---mirrors.aliyun.com-composer/, or directory is not writable. Proceeding without cache<br/>Cannot create cache directory /home/www/.cache/composer/files/, or directory is not writable. Proceeding without cache<br/>Using version ^0.1.2 for easyswoole/hot-reload<br/>./composer.json has been updated<br/><br/><br/>PATH变量设置Ok的方法如下：<br/>打开~/.bashrc<br/>sudo vim ~/.bashrc<br/>添加行： <br/>export PATH=$PATH:/home/lumen/.config/composer/vendor/bin<br/><br/><br/>用Linux系统。比如要把/etc/apache/bin目录添加到PATH中，方法有三：<br/>1.#PATH=ｃ/etc/apache/bin<br/>使用这种方法,只对当前会话有效，也就是说每当登出或注销系统以后，PATH 设置就会失效<br/><br/>2.#vi /etc/profile<br/>在适当位置添加 PATH=$PATH:/etc/apache/bin （注意：＝ 即等号两边不能有任何空格）<br/>这种方法最好,除非你手动强制修改PATH的值,否则将不会被改变<br/><br/>3.#vi ~/.bash_profile<br/>修改PATH行,把/etc/apache/bin添加进去<br/>这种方法是针对用户起作用的<br/>From:http://opsmysql.blog.51cto.com/2238445/665990<br/><br/><br/>lumen没有成功：<br/><textarea name="code" class="php" rows="15" cols="100">
su xiangdong
/usr/local/composer/composer.phar global require &quot;laravel/lumen-installer&quot;
Changed current directory to /home/xiangdong/.config/composer
</textarea><br/><br/><br/>useradd lumen<br/>su lumen<br/>cd /data/htdocs/laravel.levoo.com<br/>/usr/local/composer/composer.phar&nbsp;&nbsp;config -g repo.packagist composer https://packagist.phpcomposer.com<br/><br/><br/>进行上述设置后，laravel有门，能下载了：<br/>[lumen@a laravel.levoo.com]$ pwd<br/>/data/htdocs/laravel.levoo.com<br/>[lumen@a laravel.levoo.com]$ /usr/local/composer/composer.phar global require &quot;laravel/lumen-installer&quot;&nbsp;&nbsp;<br/>Changed current directory to /home/lumen/.config/composer<br/>Using version ^1.0 for laravel/lumen-installer<br/>./composer.json has been created<br/>Loading composer repositories with package information<br/>Updating dependencies (including require-dev)<br/>Package operations: 10 installs, 0 updates, 0 removals<br/>&nbsp;&nbsp;- Installing symfony/process (v3.2.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing psr/log (1.0.2) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing symfony/debug (v3.2.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing symfony/polyfill-mbstring (v1.3.0) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing symfony/console (v3.2.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing guzzlehttp/promises (v1.3.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing psr/http-message (1.0.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing guzzlehttp/psr7 (1.3.1) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing guzzlehttp/guzzle (6.2.2) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;- Installing laravel/lumen-installer (v1.0.2) Downloading: 100%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>symfony/console suggests installing symfony/event-dispatcher ()<br/>symfony/console suggests installing symfony/filesystem ()<br/>Writing lock file<br/>Generating autoload files<br/><br/><br/>生成文件如下：<br/>[lumen@a composer]$ pwd<br/>/home/lumen/.config/composer<br/><br/>[lumen@a composer]$ ls&nbsp;&nbsp;/home/lumen/.config/composer<br/>auth.json&nbsp;&nbsp;composer.json&nbsp;&nbsp;composer.lock&nbsp;&nbsp;config.json&nbsp;&nbsp;vendor<br/><br/><br/>开始学习数据库：<br/>http://blog.csdn.net/wowkk/article/details/52104689<br/><br/>/data/htdocs/lumen.levoo.com/blog/.env<br/>APP_ENV=local<br/>APP_DEBUG=true<br/>APP_KEY=<br/>APP_TIMEZONE=UTC<br/><br/>DB_CONNECTION=mysql<br/>DB_HOST=10.44.202.177<br/>DB_PORT=3306<br/>DB_DATABASE=levoo_egg<br/>DB_USERNAME=levoo<br/>DB_PASSWORD=new@levoo.com<br/><br/>CACHE_DRIVER=memcached<br/>QUEUE_DRIVER=sync<br/><br/>/data/htdocs/lumen.levoo.com/blog/app/Http/Controllers/AccountController.PHP<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
namespace App&#92;Http&#92;Controllers;

use Laravel&#92;Lumen&#92;Routing&#92;Controller as BaseController;
use Illuminate&#92;Http&#92;Request;

class AccountController extends BaseController
&#123;
&nbsp;&nbsp;&nbsp;&nbsp;//直接传人sql方式操作数据库
&nbsp;&nbsp;&nbsp;&nbsp;function accountController(Request $request)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name = $request-&gt;input(&quot;name&quot;);//请求参数
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$results = app(&#039;db&#039;)-&gt;select(&quot;SELECT * FROM users&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $results ;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&#125;
</textarea><br/><br/>/data/htdocs/lumen.levoo.com/blog/routes/web.php<br/>&lt;?php<br/><br/>$app-&gt;group([&quot;namespace&quot;=&gt;&quot;App&#92;Http&#92;Controllers&quot;], function()use($app)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;//账户控制器<br/>&nbsp;&nbsp;&nbsp;&nbsp;$app-&gt;get(&quot;/AccountController&quot;,[&quot;uses&quot; =&gt; &quot;AccountController@accountController&quot;]);<br/>&#125;);<br/><br/><br/>model:/data/htdocs/lumen.levoo.com/blog/app/Models/User.php<br/>&lt;?php<br/><br/>namespace App;<br/><br/>use Illuminate&#92;Database&#92;Eloquent&#92;Model;<br/>class User extends Model<br/>&#123;<br/>&#125;<br/><br/><br/><br/>在app/Http/Controllers目录下AccountController.php，修改为<br/><br/>&lt;?php<br/><br/>namespace App&#92;Http&#92;Controllers;<br/><br/>use App&#92;user;&nbsp;&nbsp; //新增部分<br/>use Laravel&#92;Lumen&#92;Routing&#92;Controller as BaseController;<br/>use Illuminate&#92;Http&#92;Request;<br/><br/>class AccountController extends BaseController<br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;//直接传人sql方式操作数据库<br/>&nbsp;&nbsp;&nbsp;&nbsp;function accountController(Request $request)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return User::all();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&#125;<br/><br/>http://101.200.189.210/AccountController/accountController
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]Linux下 php环境安装、配置composer，使用composer安装laravel/lumen、zan等框架,写一个读取数据库的。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>