zoukankan      html  css  js  c++  java
  • phpBB3.2开发环境配置

    从Github导出项目

    如果只是查看代码, 可以直接clone官方的git https://github.com/phpbb/phpbb.git . 如果需要开发, 就fork一下再从自己的Git里clone.

    下载依赖

    PhpStorm IDE方式

    在PS中打开composer.json, 右上角会提示有install, 点击后, 选择系统中的PHP可执行文件, 选择下载composer.phar, 然后确定即可.

    在墙内会比较慢, 可以在composer.json里加上这一段, 使用phpcomposer.com提供的镜像服务

    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    }
    

      

    命令行方式:

    在 phpBB 目录下执行

    php ../composer.phar install
    

    执行结果, 能看到项目依赖的各个库的版本, 其中symfony版本是3.4.15

    ~/PhpstormProjects/phpbb/phpBB$ php ../composer.phar install
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Package operations: 76 installs, 0 updates, 0 removals
      - Installing composer/installers (v1.5.0): Downloading (100%)         
      - Installing bantu/ini-get-wrapper (v1.0.1): Downloading (100%)         
      - Installing symfony/process (v3.4.15): Downloading (100%)         
      - Installing symfony/finder (v3.4.15): Downloading (100%)         
      - Installing symfony/polyfill-ctype (v1.9.0): Downloading (100%)         
      - Installing symfony/filesystem (v3.4.15): Downloading (100%)         
      - Installing symfony/polyfill-mbstring (v1.9.0): Downloading (100%)         
      - Installing psr/log (1.0.2): Downloading (100%)         
      - Installing symfony/debug (v3.4.15): Downloading (100%)         
      - Installing symfony/console (v3.4.15): Downloading (100%)         
      - Installing seld/phar-utils (1.0.1): Downloading (100%)         
      - Installing seld/jsonlint (1.7.1): Downloading (100%)         
      - Installing justinrainbow/json-schema (5.2.7): Downloading (100%)         
      - Installing composer/xdebug-handler (1.3.0): Downloading (100%)         
      - Installing composer/spdx-licenses (1.4.0): Downloading (100%)         
      - Installing composer/semver (1.4.2): Downloading (100%)         
      - Installing composer/ca-bundle (1.1.2): Downloading (100%)         
      - Installing composer/composer (1.7.2): Downloading (100%)         
      - Installing google/recaptcha (1.2.1): Downloading (100%)         
      - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
      - Installing psr/http-message (1.0.1): Downloading (100%)         
      - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
      - Installing lusitanian/oauth (v0.8.11): Downloading (100%)         
      - Installing marc1706/fast-image-size (v1.1.4): Downloading (100%)         
      - Installing patchwork/utf8 (v1.3.1): Downloading (100%)         
      - Installing psr/container (1.0.0): Downloading (100%)         
      - Installing s9e/text-formatter (0.13.1): Downloading (100%)         
      - Installing symfony/config (v3.4.15): Downloading (100%)         
      - Installing paragonie/random_compat (v1.4.3): Downloading (100%)         
      - Installing symfony/polyfill-php70 (v1.9.0): Downloading (100%)         
      - Installing symfony/http-foundation (v3.4.15): Downloading (100%)         
      - Installing symfony/event-dispatcher (v3.4.15): Downloading (100%)         
      - Installing symfony/http-kernel (v3.4.15): Downloading (100%)         
      - Installing symfony/dependency-injection (v3.4.15): Downloading (100%)         
      - Installing zendframework/zend-eventmanager (3.2.1): Downloading (100%)         
      - Installing zendframework/zend-code (2.6.3): Downloading (100%)         
      - Installing ocramius/proxy-manager (1.0.2): Downloading (100%)         
      - Installing symfony/proxy-manager-bridge (v3.4.15): Downloading (100%)         
      - Installing symfony/routing (v3.4.15): Downloading (100%)         
      - Installing twig/twig (v1.35.4): Downloading (100%)         
      - Installing symfony/twig-bridge (v3.4.15): Downloading (100%)         
      - Installing symfony/dom-crawler (v3.4.15): Downloading (100%)         
      - Installing symfony/css-selector (v3.4.15): Downloading (100%)         
      - Installing symfony/browser-kit (v3.4.15): Downloading (100%)         
      - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)         
      - Installing fabpot/goutte (v3.2.3): Downloading (100%)         
      - Installing facebook/webdriver (1.6.0): Downloading (100%)         
      - Installing symfony/yaml (v3.4.15): Downloading (100%)         
      - Installing laravel/homestead (v7.17.0): Downloading (100%)         
      - Installing phing/phing (2.4.14): Downloading (100%)         
      - Installing webmozart/assert (1.3.0): Downloading (100%)         
      - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)         
      - Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)         
      - Installing phpdocumentor/reflection-docblock (3.3.2): Downloading (100%)         
      - Installing sebastian/version (2.0.1): Downloading (100%)         
      - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
      - Installing sebastian/recursion-context (2.0.0): Downloading (100%)         
      - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)         
      - Installing sebastian/global-state (1.1.1): Downloading (100%)         
      - Installing sebastian/exporter (2.0.0): Downloading (100%)         
      - Installing sebastian/environment (2.0.0): Downloading (100%)         
      - Installing sebastian/diff (1.4.3): Downloading (100%)         
      - Installing sebastian/comparator (1.2.4): Downloading (100%)         
      - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
      - Installing doctrine/instantiator (1.0.5): Downloading (100%)         
      - Installing phpunit/phpunit-mock-objects (3.4.4): Downloading (100%)         
      - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
      - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)         
      - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
      - Installing phpunit/php-token-stream (1.4.12): Downloading (100%)         
      - Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)         
      - Installing phpspec/prophecy (1.8.0): Downloading (100%)         
      - Installing myclabs/deep-copy (1.7.0): Downloading (100%)         
      - Installing phpunit/phpunit (5.7.27): Downloading (100%)         
      - Installing phpunit/dbunit (2.0.3): Downloading (100%)         
      - Installing squizlabs/php_codesniffer (2.9.1): Downloading (100%)         
    symfony/console suggests installing symfony/lock
    lusitanian/oauth suggests installing predis/predis (Allows using the Redis storage backend.)
    patchwork/utf8 suggests installing ext-intl (Use Intl for best performance)
    patchwork/utf8 suggests installing ext-wfio (Use WFIO for UTF-8 filesystem access on Windows)
    s9e/text-formatter suggests installing ext-intl (Allows international URLs to be accepted by the URL filter)
    paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
    symfony/http-kernel suggests installing symfony/var-dumper
    symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
    zendframework/zend-eventmanager suggests installing container-interop/container-interop (^1.1.0, to use the lazy listeners feature)
    zendframework/zend-eventmanager suggests installing zendframework/zend-stdlib (^2.7.3 || ^3.0, to use the FilterChain feature)
    zendframework/zend-code suggests installing doctrine/annotations (DoctrineCommonAnnotations >=1.0 for annotation features)
    zendframework/zend-code suggests installing zendframework/zend-stdlib (ZendStdlib component)
    ocramius/proxy-manager suggests installing ocramius/generated-hydrator (To have very fast object to array to object conversion for ghost objects)
    ocramius/proxy-manager suggests installing zendframework/zend-json (To have the JsonRpc adapter (Remote Object feature))
    ocramius/proxy-manager suggests installing zendframework/zend-soap (To have the Soap adapter (Remote Object feature))
    ocramius/proxy-manager suggests installing zendframework/zend-stdlib (To use the hydrator proxy)
    ocramius/proxy-manager suggests installing zendframework/zend-xmlrpc (To have the XmlRpc adapter (Remote Object feature))
    symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
    symfony/routing suggests installing symfony/expression-language (For using expression matching)
    symfony/twig-bridge suggests installing symfony/asset (For using the AssetExtension)
    symfony/twig-bridge suggests installing symfony/expression-language (For using the ExpressionExtension)
    symfony/twig-bridge suggests installing symfony/form (For using the FormExtension)
    symfony/twig-bridge suggests installing symfony/security (For using the SecurityExtension)
    symfony/twig-bridge suggests installing symfony/stopwatch (For using the StopwatchExtension)
    symfony/twig-bridge suggests installing symfony/templating (For using the TwigEngine)
    symfony/twig-bridge suggests installing symfony/translation (For using the TranslationExtension)
    symfony/twig-bridge suggests installing symfony/var-dumper (For using the DumpExtension)
    symfony/twig-bridge suggests installing symfony/web-link (For using the WebLinkExtension)
    facebook/webdriver suggests installing ext-SimpleXML (For Firefox profile creation)
    sebastian/global-state suggests installing ext-uopz (*)
    phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
    phpunit/phpunit suggests installing ext-xdebug (*)
    phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
    Generating autoload files
    

    在PhpStorm中同时打开多个项目

    点击Open后选中项目目录, 在弹出的对话框中, 选择Open in current window, 勾选 Add to currently opened projects.

    Nginx配置文件

    在phpBB3.2中已经默认使用Restful URL, 例如升级时, 使用的地址是 forum/install/app.php/update, FAQ页面的地址就是 forum/app.php/help/faq , 在论坛安装完成之后, 虽然还可以沿用传统的URL传参形式, 但是要追求完美的话还是要把rewrite加上. 在编写nginx配置时还有另一个考虑就是安全问题. 现在引入那么多第三方库, 可以说出现漏洞的风险是非常大的, 要尽可能地避免这些第三方库带来的安全问题, 首先最简单最容易做到的就是禁止外界直接访问这些脚本.

    以下是我使用的Nginx配置文件, 可以根据自己的实际情况修改.

    server {
        listen       80;
        server_name  www.rockbb.com;
        access_log  logs/rockbb.access.log  main;
    
        location / {
            root   /var/wwwroot/rockbb;
            index  index.html index.htm index.php;
        }
    
        # Correctly pass scripts for installer
        location /forum/app.php {
            root   /var/wwwroot/rockbb;
            index index.html index.php;
    
            location ~ .php(/|$) {
                include fastcgi_params;
                fastcgi_split_path_info ^(.+.php)(/.*)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param SCRIPT_FILENAME /var/wwwroot/rockbb$fastcgi_script_name;
                fastcgi_pass   127.0.0.1:9000;
            }
        }
    
        # 禁止访问内部phpbb文件
        location ~ /forum/(bin|cache|config|ext|files|images/avatars/upload|includes|language|phpbb|
    store|vendor|config.php|common.php).* {
            deny all;
            internal;
        }
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ .php$ {
            root           /var/wwwroot/rockbb;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /$document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
    

    几个location匹配的优先级说明

    规则是:
    先精确匹配, 匹配上哪个就立即用哪个; 然后普通匹配, 不管是否匹配上, 继续进行正则匹配, 如果正则匹配不上, 则回退至上一个普通匹配. 其中普通匹配没有顺序之分, 哪个匹配最精确就使用哪个location, 而正则匹配按照规则的书写顺序进行, 只要匹配上哪个就用哪个:

    • =   精确匹配, 匹配后停止后续匹配, 直接执行该匹配后的configuration
    • [空格]  前缀匹配. 匹配后继续更长前缀匹配和正则匹配
    • ^~  非正则匹配, 终态前缀匹配(注意与空格的前缀匹配进行区别), 匹配该前缀后,停止后续正则匹配
    • ~ 区分大小写的正则匹配, 按顺序匹配,一旦匹配上即停止后续匹配
    • ~* 不区分大小写的匹配, 一旦匹配即停止后续匹配

    所以nginx配置文件的书写顺序建议是: 先写 = 号(精确匹配)部分, 然后写[空格] 前缀匹配部分, 然后写^~这种前缀匹配, 最后写正则匹配.

  • 相关阅读:
    3dsmaxunity3d
    libav android移植交叉编译
    libav 由显卡中读取数据制作视频
    超详细mysql left join,right join,inner join用法分析
    VC常见入门问题总结
    c#皮肤美化
    论坛
    vc中文件的读写操作
    MySQL的mysqldump工具的基本用法
    perl产生随机数
  • 原文地址:https://www.cnblogs.com/milton/p/9994273.html
Copyright © 2011-2022 走看看