系统:kali
登录: root
中间件:nginx
PHP框架:laravel(dcat admin)
1 上传代码压缩包和xxx-1222.sql,代码压缩包复制到/var/www/html/,并解压
cp -rf xxx-1222.zip /var/www/html/
unzip /var/www/html/xxx-1222.zip
2 编辑/etc/nginx/sites-enabled/xxx
复制default为xxx
修改内容可参考:https://learnku.com/laravel/wikis/25559 和 xxx配置文件
3 编辑/etc/nginx/nginx.conf
修改内容可参考:https://learnku.com/laravel/wikis/25559 和 nginx.conf
4 编辑/etc/php/7.4/fpm/php.ini
修改内容可参考:php.ini
主要修改extension:gmp mbstring mysqli json openssl pdo tokenizer xml bcmatch ctype
5 修改/var/www/html/xdns/storage权限
chmod -R 0755 storage
chown -R www-data:www-data storage
可参考:https://learnku.com/laravel/wikis/25560
6 创建数据库
登录mysql ,mysql -u root -p
create database xxx;
source /home/kali/Documents/xxx-1222.sql
7 配置代码中的数据库
vi /var/www/html/xxx/.env
8 遇到问题:
8.1 Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'DOMDocument' not found
解决:apt-get install php-xml
8.2 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in /var/www/html/xdns/vendor/symfony/http-foundation/HeaderUtils.php on line 65PHP message: PHP Fatal error: Uncaught TypeError: Symfony\Component\HttpFoundation\HeaderUtils::groupParts(): Argument #1 ($matches) must be of type array, null given, called in /var/www/html/xdns/vendor/symfony/http-foundation/HeaderUtils.php on line 67 and defined in /var/www/html/xdns/vendor/symfony/http-foundation/HeaderUtils.php:196
nginx 和 php 正常启动,但是页面显示500
解决:apt-get install libargon2-1 libidn2-0 libpcre2-8-0 libpcre3 libxml2 libzstd1
8.3 FastCGI sent in stderr: "PHP message: PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/xdns/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1277
解决:apt-get install php-xml