hexo/posts/1adc954a.html

531 lines
26 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="/img/logo.png">
<meta name="author" content="浪子">
<meta name="subtitle" content="一个分享自己生活的博客">
<meta name="description" content="曾梦想仗剑走天涯;因太胖放弃原计划.">
<meta name="keywords" content=",DIY,黑苹果,分享,自由">
<link rel="alternate" href="/atom.xml " title="提剑追梦" type="application/atom+xml">
<title>测试xiuno2Sforum中遇到的各种问题 | 提剑追梦</title>
<link rel="stylesheet" href="/css/style.css" >
<link rel="stylesheet" href="/css/partial/dark.css" >
<link rel="stylesheet" href="/css/partial/highlight/atom-one-light.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.sgcd.net/lxgw-wenkai-screen-webfont/lxgwwenkaigbscreen.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/a2396837/CDN@latest/css/iconfont.css">
<script src="/js/todark.js"></script>
<meta name="generator" content="Hexo 6.3.0"></head>
</html>
<div class="nav index" style="height: 60px;">
<div class="title animated fadeInDown">
<div class="layui-container">
<div class="nav-title"><a href="/" title="提剑追梦">提剑追梦</a></div>
<div class="nav-list">
<button> <span class=""></span><span style="display: block;"></span><span class=""></span> </button>
<ul class="layui-nav" lay-filter="">
<li class="layui-nav-item">
<a href="/ ">
<i class=" fab fa-fort-awesome " style="color: rgb(255 107 107);"></i>
<span class="layui-nav-item-name">首页</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/archives/ ">
<i class=" fas fa-archive " style="color: rgb(10 189 227);"></i>
<span class="layui-nav-item-name">归档</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/tags/ ">
<i class=" fas fa-hashtag " style="color: rgb(254 202 87);"></i>
<span class="layui-nav-item-name">标签</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/fcircle/ ">
<i class=" fas fa-heart " style="color: rgb(29 209 161);"></i>
<span class="layui-nav-item-name">朋友圈</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/links/ ">
<i class=" fab fa-weixin " style="color: hsl(152deg 73% 45%);"></i>
<span class="layui-nav-item-name">友链</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/memos/ ">
<i class=" fas fa-coffee " style="color:#31c7c1;"></i>
<span class="layui-nav-item-name">说说</span>
</a>
</li>
<li class="layui-nav-item">
<a href="/about/ ">
<i class=" fab fa-grav " style="color: rgb(154 106 247);"></i>
<span class="layui-nav-item-name">关于</span>
</a>
</li>
<li class="layui-nav-item" id="btn-toggle-dark">🌙</li>
<span class="layui-nav-bar" style="left: 342px; top: 78px; width: 0px; opacity: 0;"></span>
</ul>
</div>
</div>
</div>
</div>
<header class="header">
<div class="logo">
<a href="/"><img src="https://img.imsun.org/avatar.jpg" onerror=this.onerror=null,this.src="/img/loading.gif"></a>
</div>
</div>
<div class="motto">
<span>曾梦想仗剑走天涯</span>
</div>
<div class="social">
<a class="social-icon" href="https://github.com/jkjoy" target="_blank" title="Github">
<i class="iconfont icon-GitHub" aria-hidden="true"></i>
</a>
<a class="social-icon" href="mailto:jkjoy@163.com" target="_blank" title="Email">
<i class="iconfont icon-email" aria-hidden="true"></i>
</a>
<a class="social-icon" href="/atom.xml" target="_blank" title="rss">
<i class="iconfont icon-rss" aria-hidden="true"></i>
</a>
</div>
</header>
<article id="post">
<div class="post-title">测试xiuno2Sforum中遇到的各种问题</div>
<div class="post-meta">
<div class="post-meta-item date">
<span title="发表于 2023.10.06"><i class="far fa-calendar-alt"></i> 2023.10.06</span>
</div>
<div class="post-meta-item updated">
<span title="更新于 2024.06.18"><i class="far fa-calendar-check"></i> 2024.06.18</span>
</div>
<div class="post-meta-item categories">
<i class="fas fa-inbox article-meta__icon"></i> <a href="/categories/%E5%88%86%E4%BA%AB/">分享</a>
</div>
<div class="post-meta-item wordcount">
<i class="fas fa-pencil-alt"></i> <span class="post-count">499 字</span>
<i class="far fa-clock"></i> <span class="post-count">2 分钟</span>
</div>
</div>
<div class="content">
<blockquote><h3>自动摘要</h3>
ai: 这篇文章介绍了如何将XiunoBBS的数据转换成SForum格式并详细说明了在Ubuntu环境下通过使用Sforum v2.2.2版本进行测试的过程。文章中涵盖了安装和配置必要的软件和服务如PHP、MariaDB、Redis和Nginx等。同时还提到了在转换数据和安装过程中可能遇到的问题及其解决方案例如PHP扩展的安装和多版本PHP环境下的配置调整。最后文中也涉及了数据库的创建和数据导入流程。
</blockquote>
<div><p>想把<code>xiuno</code>bbs数据转换成<code>SForum</code>,由于最新版本的<code>SForum</code>没有转换工具支持<br>于是采用<code>Sforum</code> v2.2.2测试</p>
<h1 id="测试环境"><a href="#测试环境" class="headerlink" title="测试环境"></a>测试环境</h1><ul>
<li>Ubuntu 22.0.4</li>
<li>php8.0</li>
<li>mariadb10.6</li>
<li>composer</li>
<li>redis</li>
<li>nginx or apache</li>
</ul>
<h2 id="测试程序"><a href="#测试程序" class="headerlink" title="测试程序"></a>测试程序</h2><p>sforum v2.2.2</p>
<p>xiuno2sforum v2.2.2</p>
<h2 id="PHP"><a href="#PHP" class="headerlink" title="PHP"></a>PHP</h2><h3 id="安装PPA-源"><a href="#安装PPA-源" class="headerlink" title="安装PPA 源"></a>安装PPA 源</h3><p>需要使用 PPA 源安装:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo add-apt-repository ppa:ondrej/php</span><br><span class="line">sudo apt-get update</span><br></pre></td></tr></table></figure>
<h4 id="安装php8-0"><a href="#安装php8-0" class="headerlink" title="安装php8.0"></a>安装php8.0</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install php8.0</span><br></pre></td></tr></table></figure>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install -y php8.0-dev</span><br></pre></td></tr></table></figure>
<h4 id="安装拓展"><a href="#安装拓展" class="headerlink" title="安装拓展"></a>安装拓展</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install php8.0-curl php8.0-xml php8.0-gd php8.0-mbstring php8.0-redis php8.0-swoole php8.0-bcmath</span><br></pre></td></tr></table></figure>
<h3 id="查看php版本"><a href="#查看php版本" class="headerlink" title="查看php版本"></a>查看php版本</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">php -v</span><br></pre></td></tr></table></figure>
<p>查看拓展</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">php -m</span><br></pre></td></tr></table></figure>
<h3 id="切换PHP版本"><a href="#切换PHP版本" class="headerlink" title="切换PHP版本"></a>切换PHP版本</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">update-alternatives --config php</span><br></pre></td></tr></table></figure>
<p>切换到</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">update-alternatives --set php /usr/bin/php8.0</span><br></pre></td></tr></table></figure>
<h3 id="PHP-扩展-ZipArchive"><a href="#PHP-扩展-ZipArchive" class="headerlink" title="PHP 扩展 ZipArchive"></a>PHP 扩展 ZipArchive</h3><p>上传压缩包提示500错误,打开日志发现是缺少组件</p>
<h4 id="服务器上存在多个php版本手动指定php-config文件"><a href="#服务器上存在多个php版本手动指定php-config文件" class="headerlink" title="服务器上存在多个php版本手动指定php-config文件"></a>服务器上存在多个php版本手动指定php-config文件</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./configure --with-php-config=/www/server/php/73/bin/php-config</span><br></pre></td></tr></table></figure>
<h4 id="安装ZipArchive扩展"><a href="#安装ZipArchive扩展" class="headerlink" title="安装ZipArchive扩展"></a>安装ZipArchive扩展</h4><h5 id="编译ZipArchive"><a href="#编译ZipArchive" class="headerlink" title="编译ZipArchive"></a>编译<code>ZipArchive</code></h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">cd ~</span><br><span class="line">wget http://pecl.php.net/get/zip</span><br><span class="line">tar -zxvf zip</span><br><span class="line">cd zip-x.x.x</span><br><span class="line">phpize</span><br><span class="line">./configure</span><br><span class="line">make</span><br><span class="line">make install</span><br></pre></td></tr></table></figure>
<h4 id="成功安装zip之后会返回一个路径"><a href="#成功安装zip之后会返回一个路径" class="headerlink" title="成功安装zip之后会返回一个路径"></a>成功安装zip之后会返回一个路径</h4><p>类似</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Installing shared extensions: /www/server/php/8/lib/php/extensions/no-debug-non-zts-20180731/</span><br></pre></td></tr></table></figure>
<h4 id="加到php-ini中"><a href="#加到php-ini中" class="headerlink" title="加到php.ini中"></a>加到php.ini中</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">extension=/www/server/php/8/lib/php/extensions/no-debug-non-zts-20180731/zip.so</span><br></pre></td></tr></table></figure>
<p><br><code>php.ini</code>中添加</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">extension=zip.so</span><br></pre></td></tr></table></figure>
<h4 id="提示checking-for-libzip-not-found"><a href="#提示checking-for-libzip-not-found" class="headerlink" title="提示checking for libzip... not found"></a>提示<code>checking for libzip... not found</code></h4><h5 id="编译libzip"><a href="#编译libzip" class="headerlink" title="编译libzip"></a>编译<code>libzip</code></h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">wget https://libzip.org/download/libzip-1.3.2.tar.gz</span><br><span class="line">tar xvf libzip-1.3.2.tar.gz</span><br><span class="line">cd libzip-1.3.2</span><br><span class="line">./configure</span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line">export PKG_CONFIG_PATH=&quot;/usr/local/lib/pkgconfig/&quot; </span><br></pre></td></tr></table></figure>
<h3 id="在使用插件转换数据中一直报错无法使用的class-medoo"><a href="#在使用插件转换数据中一直报错无法使用的class-medoo" class="headerlink" title="在使用插件转换数据中一直报错无法使用的class medoo"></a>在使用插件转换数据中一直报错无法使用的class medoo</h3><p>所以使用cpmposer安装</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer require catfan/Medoo</span><br></pre></td></tr></table></figure>
<h2 id="mariadb"><a href="#mariadb" class="headerlink" title="mariadb"></a>mariadb</h2><h3 id="创建数据库"><a href="#创建数据库" class="headerlink" title="创建数据库"></a>创建数据库</h3><p><a target="_blank" rel="noopener" href="https://www.jkjoy.cn/2023/dfdf0a76.html">Mariadb创建数据库、用户及授权</a></p>
<h3 id="数据导入"><a href="#数据导入" class="headerlink" title="数据导入"></a>数据导入</h3><p>导入sql备份文件</p>
<p>进入数据库</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql -uroot -p</span><br></pre></td></tr></table></figure>
<p>使用数据库bbs</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">use bbs</span><br></pre></td></tr></table></figure>
<p>导入sql路径</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">source /root/bbs.sql;</span><br></pre></td></tr></table></figure>
<h2 id="安装-Redis"><a href="#安装-Redis" class="headerlink" title="安装 Redis"></a>安装 Redis</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install redis-server</span><br></pre></td></tr></table></figure>
<h2 id="安装-Nginx"><a href="#安装-Nginx" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install nginx</span><br></pre></td></tr></table></figure>
<h2 id="安装composer"><a href="#安装composer" class="headerlink" title="安装composer"></a>安装composer</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">apt install git zip unzip</span><br><span class="line">curl -sS https://getcomposer.org/installer | php</span><br><span class="line">mv composer.phar /usr/local/bin/composer</span><br><span class="line">chmod +x /usr/local/bin/composer</span><br></pre></td></tr></table></figure>
<h2 id="安装SForum-v2-2-2"><a href="#安装SForum-v2-2-2" class="headerlink" title="安装SForum v2.2.2"></a>安装SForum v2.2.2</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer create-project zhuchunshu/sforum=v2.2.2 sforum</span><br></pre></td></tr></table></figure>
<p>进入安装目录,</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd sforum</span><br></pre></td></tr></table></figure>
<p>按照提示,连续执行命令即可完成安装(启动服务也是此命令):</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">php CodeFec CodeFec</span><br></pre></td></tr></table></figure>
</div>
<div class="post-copyright">
<div class="copyright-item">
<span> 作者: 浪子</span>
</div>
<div class="copyright-item">
<span> 链接: <a href="https://blog.jkjoy.cn/posts/1adc954a.html">https://blog.jkjoy.cn/posts/1adc954a.html</a></span>
</div>
<div class="copyright-item">
<span> 声明: 本博客所有文章除特别声明外,均采用许可协议 <a target="_blank" rel="noopener" href="http://creativecommons.org/licenses/by-nc/4.0/">CC-BY-NC-4.0</a> 转载请注明出处!</span>
</div>
</div>
</div>
<div class="share-reward">
<div class="share">
<div class="social-share" data-sites="wechat,weibo,qq"></div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css">
<script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js"></script>
</div>
<div class="reward">
<div style="padding: 10px 0; margin-left: 20px; width: 90%; text-align: center;">
<div class="reward-content">
<ul id="donateBox" class="list pos-a">
<li id="PayPal"><a href="https://paypal.me/jkjoy" target="_blank" title="贝宝">贝宝</a></li>
<li id="AliPay" title="支付宝"><img data-img="https://blogcdn.loliko.cn/ali.png" onerror=this.onerror=null,this.src="/img/loading.gif"></img></li>
<li id="WeChat" title="微信"><img date-img="https://blogcdn.loliko.cn/wx.png" onerror=this.onerror=null,this.src="/img/loading.gif"></img></li>
</ul>
<div id="QRBox" class="pos-f left-100">
<div id="MainBox"></div>
</div>
</div>
</div>
</div>
</div>
<div class="post_tags">
<i class="fas fa-tag"></i> <a href="/tags/SForum/" class="tag">SForum</a>
</div>
<div class="post-nav">
<div class="post-nav-prev post-nav-item">
<a href="/posts/d29d6713.html" >快速部署misskey实例<i class="fa fa-chevron-left"></i></a>
</div>
<div class="post-nav-next post-nav-item">
<a href="/posts/dfdf0a76.html" >Mariadb创建数据库、用户及授权<i class="fa fa-chevron-right"></i></a>
</div>
</div>
<h3><i class="far fa-comment"></i> 评论</h3>
<div id="tcomment"></div>
<script src="/js/twikoo.all.min.js"></script>
<script>
twikoo.init({
envId: 'https://t.jkjoy.cn',
el: '#tcomment',
})
</script>
</article>
<a id="gotop" href="javascript:" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
<div id="bottom-outer">
<div id="bottom-inner">
© 2020 <i class="fa fa-heart" id="heart"></i> 浪子
<br>
Powered by
<a target="_blank" rel="noopener" href="http://hexo.io">hexo</a> | Theme is <a target="_blank" rel="noopener" href="https://github.com/a2396837/hexo-theme-blank/">blank</a>
<div class="icp-info">
<a href="https://beian.miit.gov.cn/" target="_blank"> 鄂ICP备16022970号-16</a>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/layui-src@2.5.5/dist/layui.min.js"></script>
<script src="/js/script.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<script>
window.lazyLoadOptions = {
elements_selector: 'img',
threshold: 0
}
</script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script>
<script>
var images = $('img').not('.nav-logo img').not('.card img').not($('a>img')).not('.reward-content img')
images.each(function (i, o) {
var lazyloadSrc = $(o).attr('data-src') ? $(o).attr('data-src') : $(o).attr('src')
$(o).wrap(`<a href="${lazyloadSrc}" data-fancybox="group" data-caption="${$(o).attr('alt')}" class="fancybox"></a>`)
})
</script>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script>
<script>
$().fancybox({
selector: '[data-fancybox]',
loop: true,
transitionEffect: 'slide',
protect: true,
buttons: ['slideShow', 'fullScreen', 'thumbs', 'close']
})
</script>
<script>
jQuery(document).ready(function () {
var QRBox = $('#QRBox');
var MainBox = $('#MainBox');
var AliPayQR = 'https://blogcdn.loliko.cn/ali.png';
var WeChanQR = 'https://blogcdn.loliko.cn/wx.png';
function showQR(QR) {
if (QR) {
MainBox.css('background-image', 'url(' + QR + ')');
}
$('#donateBox').addClass('blur');
QRBox.fadeIn(300, function (argument) {
MainBox.addClass('showQR');
});
}
$('#donateBox>li').click(function (event) {
var thisID = $(this).attr('id');
if (thisID === 'AliPay') {
showQR(AliPayQR);
} else if (thisID === 'WeChat') {
showQR(WeChanQR);
}
});
MainBox.click(function (event) {
MainBox.removeClass('showQR').addClass('hideQR');
setTimeout(function (a) {
QRBox.fadeOut(300, function (argument) {
MainBox.removeClass('hideQR');
});
$('#DonateText,#donateBox,#github').removeClass('blur');
}, 600);
});
});
</script>
<script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.4/dist/clipboard.min.js"></script>
<script>
!function (e, t, a) {
var initCopyCode = function(){
var copyHtml = '';
copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
copyHtml += ' <i class="fa fa-clipboard"></i><span>复制</span>';
copyHtml += '</button>';
$(".highlight .code pre").before(copyHtml);
new ClipboardJS('.btn-copy', {
target: function(trigger) {
return trigger.nextElementSibling;
}
});
}
initCopyCode();
}(window, document);
</script>
<script>
var btntop = $('#gotop');
btntop.on('click', function (e) {
e.preventDefault();
$('html, body').animate({ scrollTop: 0 }, '300');
});
var $table = $('.content table').not($('figure.highlight > table'))
$table.each(function () {
$(this).wrap('<div class="table-wrap"></div>')
})
</script>
</html>