2023 Use the Discuz Q forum system to build a three-terminal (h5, applet, pc) toss and step on the pit summary

2023 Use the Discuz Q forum system to build a three-terminal (h5, applet, pc) toss and step on the pit summary

Prerequisites for reading this article:

  • All the installation and construction processes in this article are based on the official installation document pagoda panel. Please read the official documentation carefully before reading this article.
  • There are two versions of the official document, please find out which version of the document you are looking at (fat intestines are important)
  • This article was written on March 30, 2023.
  • All stepping pits have been marked in a special format
  • After installing fileinfoand exiftwo extensions according to the document, please restart the php service , otherwise the installer will not recognize
  • The early installation of Php7.3 on the pagoda panel compiled the zip extension independently, and the subsequent installation and upgrade were integrated and compiled, resulting in repeated loading of the zip module after the upgrade. To avoid this error, the later PHP will no longer compile the ZIP
    extension separately .
    Then, in PHP 7.3.8, the ZIP module is no longer integrated, but there is no option to install the ZIP extension in the panel configuration.
    In this way, the new installation of php7.3 will cause the problem of phpzip loss,
    but the ZIP extension is included in the software package. To solve this problem, you only need to add it manually.
    SSH login to the Linux server, first enter php73the extension installation directory (because php The zip extension file has been downloaded in the extension, so you don’t need to download it yourself, just install it directly)
cd /www/server/php/73/src/ext/zip/
/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
make
make install

After installing the zip extension, you also need to enable it in the PHP configuration file.
Add this line in php.ini:

extension = zip.so
  • It is to delete the disableputenv , readlink, symlink, shell_execfunction, not to delete .
    After the php configuration is complete, set pseudo-static, change the running directory, and set gzip.
    Visit http://<绑定网站的域名名称>/dl.php
    Set up a cron job
sudo -u www /usr/bin/php /www/wwwroot/<网站主目录>/disco schedule:run

Small program/h5 build

The old version of the official document provides two building methods, namely through HBuilderX and npm.
But this is outdated.

  • The new discuz applet can only be built using npm . If you use HBuilderX to build, it will directly prompt that the compilation failed.
  • Mini programs have strict requirements on the npm version. Strictly restrict node: 14.x.xversion with npm: 6.14.. If you have installed a higher version of npm , the dependent files cannot be installed.
    Solution:
    step1. Re-download node on the official website: 14.xx
    step2. Use the control panel to uninstall the node that has been installed in a higher version, and install the old version node just downloaded
    step3. Execute
npm uninstall -g npm  # 全局卸载npm,默认卸载高版本npm

step4. Execute again

npm uninstall -g npm  # 很玄学,但是再次执行卸载的确会更新旧版本npm

When you use the correct npm version to install sass dependencies, due to domestic network problems, you need to replace the mirror source , otherwise it will become popular

  • implement
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
npm install

If you installed it according to the official old version documentation, then when you successfully install all dependencies and start building the applet. According to the official command, an error will still be reported, don't panic, the official has secretly changed the build command
+

npm run build:weapp

is the new version of the build command

So far, the applet is built, and the source code of the built WeChat applet can be found in the dist directory, and source-level debugging can be performed. However, when uploading, it will
prompt: the size of a single subpackage/main package cannot exceed 2M , so the upload fails.
The biggest pitfall in the process of building the discuz forum system is here.
In fact, whether it is a new version of the document or an old version of the document, the latest version that can be installed successfully is 3.0.6. And this version, whether it is a small program or a PC, has been officially abandoned. The official has released the new 4.2 version of discuz in the forum, as well as the source code of the mini program without compiling. Discuz has also been updated to a single-circle version (users are webmaster fans) and multi-circle versions (users are data fans). And these are not mentioned in the official documents.

new build

Therefore, the construction process of the mini program can be simplified into one step: download the official source code provided by the forum and upload it to your own account.

  • If you have already installed the 3.0.6 version for PC and want to upgrade the official 4.2react version, please note: the official version provides two upgrade packages, please download and overwrite the installation version, the file size is 31M . And execute the official upgrade command in the website directory , otherwise the database link will fail .

postscript

There is no way to go in vain in life. Only by studying more and doing more can we achieve our goals. During this build process, although a series of operations were performed on npm (or tried HBuilderX), they were actually invalid. However, every failure leads to success.

おすすめ

転載: blog.csdn.net/qq_46832407/article/details/129865000