`
sillycat
  • 浏览: 2542954 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Flarum BBS System(1)Installation and Introduction

 
阅读更多
Flarum BBS System(1)Installation and Introduction

Try an open source BBS website. Flarum
First try the steps on my local MAC
> php -version
PHP 7.2.11 (cli) (built: Oct 23 2018 08:40:58) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

And I have a MySQL Database on my Local as well.

> composer --version
Composer version 1.6.5 2018-05-04 11:44:59

In the document in detail, it says, it can not work with 7.2, only up to 7.1. Let’s try first.
Command runs to create flarum
In the working directory
> mkdir flarum
> cd flarum/
> composer create-project flarum/flarum . --stability=beta

It seems we need execute the command to install the dependency
> composer install

Exception Happened Here
- flarum/core v0.1.0-beta.6 requires intervention/image ^2.3.0 -> satisfiable by intervention/image[2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.2].
- intervention/image 2.3.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.

Solution:
https://stackoverflow.com/questions/23771117/requires-ext-fileinfo-how-do-i-add-that-into-my-composer-json-file
http://image.intervention.io/getting_started/installation

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

Solution:
> brew install autoconf

Once we have autoconf, we will go on install Fileinfo-1.0.4
> wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz
> tar -zxf Fileinfo-1.0.4.tgz
> cd Fileinfo-1.0.4
> phpize
> ./configure

Exception in this step
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution

Solution:
https://gist.github.com/eparreno/1845561
> brew install libmagic

Once we have lib magic, go on with configure and installation.
> ./configure
> make

During make, it seems version conflict error happen. Reinstall PHP with that enable --enable-fileinfo

> ./configure --prefix=/Users/hluo/tool/php-7.2.12 --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-maintainer-zts --enable-fileinfo

Change Makefile
EXTRA_LIBS = -lz -lresolv -liconv -liconv -lintl -lpng -lz -ljpeg -lz -lm -lpthread -lxml2 -lz -licucore -lm -lcurl -lxml2 -lz -licucore -lm -lfreetype -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm /usr/local/Cellar/libiconv/1.15/lib/libiconv.dylib -lssl -lcrypto

Yeah, compose install success after that.
> cd /Users/hluo/tool/flarum
> composer install

Set Up Nginx Configuration
user  hluo staff;
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
root   /opt/flarum;
        index index.php index.html index.htm;
        location / { try_files $uri $uri/ /index.php?$query_string; }
        location /api { try_files $uri $uri/ /api.php?$query_string; }
        location /admin { try_files $uri $uri/ /admin.php?$query_string; }
        location /flarum {
            deny all;
    return 404;
        }
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass   127.0.0.1:9000;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param HTTP_PROXY "";
            fastcgi_index index.php;
        }
       
        location ~* \.html$ { expires -1; }
       
        location ~* \.(css|js|gif|jpe?g|png)$ {
          expires 1M;
          add_header Pragma public;
          add_header Cache-Control "public, must-revalidate, proxy-revalidat";      
}
        gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
#text/html -- text/html is gzipped by default by nginx
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";  
    }
}


Visit the Page
http://localhost/

Create MySQL Database First
> create database flarum;
> use mysql;
> grant all privileges on flarum.* to flarum@"%" identified by 'flarum';
> flush privileges;

Visit the page and set up the database.

Set Up on CentOS
Similar steps with MAC, some differences are as follow:
> ./configure --prefix=/home/carl/tool/php-7.2.12 --enable-fpm --with-fpm-user=carl --with-fpm-group=staff --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-maintainer-zts --enable-fileinfo


Install Nginx On CentOS
> ./configure --prefix=/home/carl/tool/nginx-1.14.0
> make
> make install
Put in the Working directory

Set Composer and Flarum
> sudo curl -sS https://getcomposer.org/installer | php
> sudo mv composer.phar /usr/local/bin/composer
> sudo chmod a+x /usr/local/bin/composer
> composer --version
Composer version 1.7.3 2018-11-01 10:05:06

Set Up Flarum
> mkdir flarum
> cd flarum/
> composer create-project flarum/flarum . --stability=beta

Start PHP-FPM, start Nginx, We can visit http://localhost
Set Up MySQL on RaspberryPi
> sudo apt-get install mysql-server
> sudo vi /etc/mysql/my.cnf
Change bind-address to 0.0.0.0

Restart MySQL
> sudo service mysql restart

After Post One Discussion, Here is the Issues on Page
Warning: count(): Parameter must be an array or an object that implements Countable in /home/carl/tool/flarum/vendor/flarum/core/src/Core/Post/RegisteredTypesScope.php on line 52
Fatal error: Uncaught RuntimeException: Unable to emit response; headers already sent in /home/carl/tool/flarum/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php:37 Stack trace: #0 /home/carl/tool/flarum/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php(30): Zend\Diactoros\Response\SapiEmitter->assertNoPreviousOutput() #1 /home/carl/tool/flarum/vendor/zendframework/zend-diactoros/src/Server.php(167): Zend\Diactoros\Response\SapiEmitter->emit(Object(Zend\Diactoros\Response)) #2 /home/carl/tool/flarum/vendor/flarum/core/src/Http/AbstractServer.php(36): Zend\Diactoros\Server->listen(Object(Zend\Stratigility\NoopFinalHandler)) #3 /home/carl/tool/flarum/index.php(16): Flarum\Http\AbstractServer->listen() #4 {main} thrown in /home/carl/tool/flarum/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php on line 37

Maybe because of the PHP Version, Let’s try in Docker Installation

References:
https://github.com/flarum/flarum
https://flarum.org/docs/installation/
https://www.lijiaocn.com/%E6%96%B9%E6%B3%95/2017/11/21/flarum-usage.html
https://github.com/flarum/flarum
https://hk.saowen.com/a/1be15c911e8571cc31eae0a27be8ee1b2a654a653b10f8f36b901e915974e31c


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics