标题描述传说中收集龙珠可以召唤神龙。不过使用php常用开发框架laravel的技术栈,大版本惊人的统一,都是8.centos8,php8,mysql8,laravel8。(假装不知道ubuntu也是很多人用过。。)使用linux的好处是开发环境和部署环境高度统一,win10和docker的普及使得所有的php程序员都可以轻松的在linux环境下使用windows电脑和mac电脑.同时,阿里巴巴开源镜像站的存在,使得本文所有软件的安装时间仅需2分钟左右,简直无法形容。这也是写这个系列文章的初衷。下面列出了这4类软件的主要版本8的发布时间。本文软件版本分别为centos8.2php8.0.0mysql8.0.21laravel8.16.1首先安装阿里的centos仓库。(centos8)curl-o/etc/yum.repos.d/CentOS-Base.repohttps://mirrors.aliyun.com/repo/Centos-8.reporm-f/etc/yum.repos.d/CentOS-centosplus.reporm-f/etc/yum.repos.d/CentOS-PowerTools.reporm-f/etc/yum.repos.d/CentOS-Extras.reporm-f/etc/yum.repos.d/CentOS-AppStream.repodnfmakecachednfrepolist安装阿里的epel仓库。(centos8)dnfinstall-yepel-releasesed-i's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|'/etc/yum.repos.d/epel*sed-i's|^metalink|#metalink|'/etc/yum.repos.d/epel*dnfmakecachednfrepolist安装阿里的remi的库(centos8)dnfinstall-yhttps://mirrors.aliyun.com/remi/enterprise/remi-release-8.rpmsed-i's/https*://rpms.remirepo.net/https://mirrors.aliyun.com/remi/g'/etc/yum.repos.d/remi*sed-i's/#baseurl/baseurl/g'/etc/yum.repos.d/remi*sed-i's|^mirrorlist|#mirrorlist|'/etc/yum.repos.d/remi*dnfmakecachednfrepolist安装php8(centos8)dnfinstall-yyum-utilsdnfinstall-yphp80php80-php-develphp80-php-fpmphp80-php-mbstringphp80-php-memcachedphp80-php-redisphp80-php-mysqlndphp80-php-pdophp80-php-bcmathphp80-php-xmlphp80-php-gdphp80-php-gmpphp80-php-igbinaryphp80-php-imagickphp80-php-pdo_mysqlphp80-php-posixphp80-php-simplexmlphp80-php-opcachephp80-php-xslphp80-php-xmlwriterphp80-php-xmlreaderphp80-php-swoolephp80-php-zipphp80-php-yamlphp80-php-uuid体验闪电般的速度!提示:php80-php-memcachephp80-php-mcryptphp80-php-phalconphp80-php-yarphp80-php-yaf还没有找到,所以没有放在上面的命令中安装阿里的composer镜像源(centos8)ln-s/usr/bin/php80/usr/bin/phpcurl-o/usr/local/bin/composerhttps://mirrors.aliyun.com/composer/composer.pharchmod+x/usr/local/bin/composercomposerconfig-grepo.packagistcomposerhttps://mirrors.aliyun.com/composer/安装nginx并集成php-fpm服务(centos8)下面echo是命令,必须使用一起复制dnfmakecachednfinstall-ynginxsystemctlenablenginxsystemctlenablephp80-php-fpmsed-i's/user=apache/user=nginx/g'/etc/opt/remi/php80/php-fpm.d/www.confsed-i's/group=apache/group=nginx/g'/etc/opt/remi/php80/php-fpm.d/www.confsed-i's/listen=/var/opt/remi/php80/run/php-fpm/www.sock/listen=9000/g'/etc/opt/remi/php80/php-fpm.d/www.confrm-f/etc/nginx/conf.d/default.confvi/etc/nginx/conf.d/default.conf/etc/nginx/conf.d/default.conf文件内容如下server{listen80;服务器名称本地主机;字符集utf-8;access_log/var/log/nginx/host.access.logmain;根/www/博客/公共;indexindex.phpindex.htmlindex.htm;错误页面404500502503504/50x.html;location=/50x.html{root/www/blog/public;}location/{try_files$uri$uri//index.php?$query_string;}location~.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$realpath_root$fastcgi_script_name;包括fastcgi_params;}}安装mysql8(centos8)其实用的是阿里的镜像,因为是从AppStream库下载的,速度极快进入mysql服务。进入后执行以下命令创建一个名为laravel的空数据库,然后用quit退出。创建数据库laravel默认字符集utf8mb4;安装redis、git等常用库(centos8)dnfinstall-ygitwgetvimrediszipunzipp7ziprsynccrontabssupervisornet-toolspython3systemctlenableredissystemctlstartredisinstalllaravel8(centos8)其实也是用阿里的镜像,因为作曲家图像源已经设置。假设项目名为blog,安装在/www目录下mkdir-p/wwwcd/wwwcomposercreate-project--prefer-distlaravel/laravelblog"8.*"rm-f./blog/routes/web.phpvi。/blog/routes/web.php
n";echo"php:".phpversion()."
n";echo"laravel:".app()::VERSION."
n";$dbversion=DB::select("selectversion()v");echo"mysql:".$dbversion[0]->v."
n";});启动php-fpm和nginx并验证是否正确安装systemctlstartnginxsystemctlstartphp80-php-fpmcurllocalhost/您将看到类似于以下内容的输出:operatingsystem:RedHatEnterpriseLinuxrelease8.2(Ootpa)
php:8.0.0
laravel:8.16.1
mysql:8.0.21
