虚拟机安装 PHPHub5(一)

打开 PHPHUB5 官网

访问GITHUB图标 -->> 去往PHPHUB5的GITHUB项目

虚拟机环境

nginx version 1.10.0 need Nginx 1.8+
php version 7.0.7 need PHP 5.6+
mysql version 5.7.11 need Mysql 5.7+
redis version 3.2.0 need Redis 3.0+
memcached version 1.4.25 need Memcached 1.4+
完全符合PHPHUB5的要求

1、克隆代码到本地

git clone https://github.com/summerblue/phphub5.git

2、由于不知道什么是HOMESTEAD,所以我直接进行COMPOSER安装依赖包(如果COMPOSER是外库,可以去喝杯茶了)

cd phphub5
composer install

  • Generating optimized class loader
  • Compiling common classes
  • 提示上面的两行,表示COMPOSER安装成功

3、生成配置文件(我更愿意说复制一份配置文件)

cp .env.example .env

4、使用安装命令

php artisan est:install


  • php artisan key:generate
  • [ErrorException]
  • shell_exec() has been disabled for security reasons
  • 使用上述命令后,提示错误,意思为shell_exec()未开启,请找到php.ini开启。
  • 上述修改完成后,继续运行会卡住。输入:
  • yes
  • 并回车。
  • 提示错误

  • Application In Production! *

  • Do you really wish to run this command? (yes/no) [no]:
  • [PDOException]
  • SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)


  • php artisan est:init-rbac
  • [PDOException]
  • SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

  • 以上错误未mysql,提示没有这个用户(homestead),请返回第3步,在你复制完.env文件后,修改此文件内mysql的配置

6、配置HOST文件我这里写的是127.0.0.1,在虚拟机外面我可以也绑定这个域名,到这个虚拟机的内网或局域网IP

echo "127.0.0.1 phphub5.app" | sudo tee -a /etc/hosts

7、php部分安装完成(测试在本机配置域名指向虚拟机IP成功,需要添加NGINX里的SERVER来配对域名)
共享一份phphub5或算是laravel的nginx.server配置

    server {
                    listen 80 default_server;
                    #listen [::]:80 default_server ipv6only=on;
                    server_name phphub5.app;
                    index index.html index.htm index.php;
                    root  /home/wwwroot/default/phphub5/public;

                    #error_page   404   /404.html;
                    include enable-php.conf;

                    location /nginx_status
                    {
                            stub_status on;
                            access_log   off;
                    }

                    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                    {
                            expires      30d;
                    }

                    location ~ .*\.(js|css)?$
                    {
                            expires      12h;
                    }

                    location ~ /\.
                    {
                            deny all;
                    }

                    location / {
            try_files $uri $uri/ /index.php?$query_string;
                    }

                    location ~ \.php$ {
                                    fastcgi_pass 127.0.0.1:9000;
                                    fastcgi_index index.php;
                                    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                                    include fastcgi_params;
                    }
                    access_log  /home/wwwlogs/phphub5.access.log;
    }
  • 请修改 .env 文件为 APP_ENV=local 和 APP_DEBUG=true 。
  • 首页地址:http://phphub5.app/
  • 管理后台:http://phphub5.app/admin/
  • 在开发环境下,直接访问后台地址即可登录 1 号用户。
  • 在使用上述方法后访问phphub5.app的时候,提示error
  • Connection timed out [tcp://127.0.0.1:6379]
  • 上面的redis问题,1是请求不到,有可能是redis启动不完善。2是redis有警报什么的,我设置完重启下好了。
  • 访问 phphub5.app/admin/ 报404错误
  • 是由于没有在nginx.server中加上最重要的一个路由,所有请求都走index.php。如下:

    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }

今天暂时书写到这里,明天继续,先睡觉了。

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 11

装上了吗

8年前 评论

@bxlabs 装上了,咋了呀?

8年前 评论

虚拟机什么系统

8年前 评论

@bxlabs vm12装的最小化centos7,一键安装的lnmp

8年前 评论

我按着方法测试 完全正确后 , 打开页面 空白 。。。。明显没有admin目录 和 首页文件内容。请问怎么解决?
楼主能否把 hosts 文件贴上来

8年前 评论

@shenyukun 明显没有目录?这个我不是很理解啊,是哪里出错了吗?

8年前 评论

@thinkcc 我搞定了。 。。可是除了进后台很快,前台页面打开超级慢 。。。。卡死了 ,半小时都打不开网站。。

8年前 评论

@shenyukun 本地的话不应该是这样啊,你看看debug是哪里耗费时间了?

8年前 评论

@thinkcc
@thinkcc debug 怎么看 这个从来没用过

8年前 评论

@shenyukun 开启debug,会在页面右下角有个图标,点开就可以看每个步骤的执行时间了。

8年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!