首页 » SEO优化 » phpartisanmigrate报错技巧_轻松搞定Laravel安装过程中的碰着常见异常问题

phpartisanmigrate报错技巧_轻松搞定Laravel安装过程中的碰着常见异常问题

访客 2024-11-10 0

扫一扫用手机浏览

文章目录 [+]

序言:Laravel的安装办法有好几种,常用的安装办法:直接下载压缩文件安装、composer安装、github安装等,现在我用composer安装,composer安装须要把稳,你的机器上必须安装有composer软件。

1、首先根据官网实行composer安装

phpartisanmigrate报错技巧_轻松搞定Laravel安装过程中的碰着常见异常问题

// 最好设置一个海内源,用阿里云的composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/// 开始安装项目composer create-project --prefer-dist laravel/laravel blog

2、设置一个唯一秘钥

phpartisanmigrate报错技巧_轻松搞定Laravel安装过程中的碰着常见异常问题
(图片来自网络侵删)

php artisan key:generate

3、访问:

http://www.xxx.com/index.php常见问题:

那么我们的问题来了哈!
上面的安装很大略,但运行的时候到处都是问题。

1、安装哀求:

PHP >= 7.2.5BCMath PHP 拓展Ctype PHP 拓展Fileinfo PHP 拓展JSON PHP 拓展Mbstring PHP 拓展OpenSSL PHP 拓展PDO PHP 拓展Tokenizer PHP 拓展XML PHP 拓展

办理:首先你的开拓环境就必须要知足以上的条件,差一个都要报错,如果不知道从哪里看扩展是否安装成功,在环境下新建一个phpinfo.php文件,访问:http://localhost/phpinfo.php,看到如下界面便是访问正常,再找到相应的扩展。

2、扩展也安装完成,却涌现不能访问涌现403情形,那是什么问题呢?

办理:php内部有禁用函数,须要把禁用函数开释掉。
(我的是本地开拓,全部去掉了,线上运行不要全部开释,须要禁用的还是要禁用)

liunx环境下:/usr/local/nginx/conf fastpram.conf 注释末了一行

3、访问目录不存在

办理:

// 实行composer install 或者 composer update

4、以下代码缺点。

Fate:In Connection.php line 664: SQLSTATE[HY000]: General error:PDO::ATTR_STATEMENT_CLASS requires format array(classname,array(ctor_args)); the classname must be a string specif ying an existing class(SQL: select from information_schema.tables where table_schema = blog and table_name = xxx_migrations)In PDOConnection.php line 50: SQLSTATE[HY000]: General error:PDO::ATTR_STATEMENT_CLASS requires format array(classname,array(ctor_args)); the classname must be a string specif ying an existing classIn PDOConnection.php line 47: SQLSTATE[HY000]: General error:PDO::ATTR_STATEMENT_CLASS requires format array(classname,array(ctor_args)); the classname must be a string specif ying an existing classIn PDOStatement.php line 40: syntax error, unexpected const(T_CONST), expecting variable(T_VARIABLE)

办理:把版本升级到7.2.5以上,就直接办理。

5、以下代码缺点。

composer installLoading composer repositories withpackage informationInstalling dependencies(including require-dev)from lock fileYour requirements could not be resolved to an installable setof packages. Problem 1 - This package requires php >=7.0.0 but your PHPversion(5.6.27) does not satisfy that requirement. Problem 2 - Installation request for doctrine/annotations v1.6.0-> satisfiable by doctrine/annotations[v1.6.0]. - doctrine/annotations v1.6.0 requires php ^7.1-> your PHPversion(5.6.27) does not satisfy that requirement. Problem 3 - Installation request for doctrine/cache v1.7.1-> satisfiable by doctrine/cache[v1.7.1]. - doctrine/cache v1.7.1 requires php ~7.1-> your PHPversion(5.6.27) does not satisfy that requirement.

办理:把版本升级到7.1以上,就直接办理。

6、缓请安题。

办理:上面的四个文件夹必须存在,如果没有须要手动创建,实行php artisan cache:clear清理缓存

7、以下所示:

办理如下,取消禁用函数。

8、页面不能访问(liunx环境下)

办理:由于strong没有写入权限导致的 进入项目根目录

chmod 777 strong -R

9、实行php artisan migrate报错

PHP Warning:require(/server/web/test_api/vendor/autoload.php): failed to open stream: No such file or directory in/server/web/test_api/artisan on line 18PHP Fatal error:require(): Failed opening required '/server/web/test_api/vendor/autoload.php'(include_path='.:/usr/local/php/lib/php')in/server/web/test_api/artisan on line 18

办理:先实行composer install 在实行 php artisan migrate

10、内存不敷报错

办理:只能加硬件了,没有其他办法

以上总结了部分常规问题,如果你碰着了,那么很快就能办理,后期碰着的问题,我都会记录下来,后面发文更新,记得随时关注哟!
公众号(Laravel技能社区).

标签:

相关文章

mongodbphplimit技巧_MongoDB PHP

确保连接及选择一个数据库为了确保精确连接,你须要指天命据库名,如果数据库在mongoDB中不存在,mongoDB会自动创建代码片段...

SEO优化 2024-12-07 阅读0 评论0