当前位置:网站首页>PHP的Laravel与Composer部署项目时常见问题
PHP的Laravel与Composer部署项目时常见问题
2022-04-23 20:39:00 【小简(JanYork)】
我们在部署PHP项目时,其实大部分的PHP项目会创建环境检测与一键**Install**页面。
但是,有许多的项目还采用了Composer部署。
什么是Composer
至于什么是Composer,我就简单说一下。
Composer是 PHP 的一个依赖管理工具。我们可以在项目中声明所依赖的外部工具库,Composer 会帮你安装这些依赖的库文件,有了它,我们就可以很轻松的使用一个命令将其他人的优秀代码引用到我们的项目中来。
相当于Node里面的npm。
Laravel框架

Laravel是一个开源PHP框架,功能强大且易于理解。它遵循模型 - 视图 - 控制器设计模式(MVC)。Laravel重用了不同框架的现有组件,这有助于创建Web应用程序。这样设计的Web应用程序更加结构化和实用。
具体特点我就不说了,其中比较显著的是,依赖管理器完全基于composer。
报错:php artisan key:generate
这个错误,一般有三个问题,对应解决一下。
报错1:PHP脚本占用内存太多,memory_limit默认128m不够用。 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted 。 Composer命令失败: Composer内部增加memory_limit到1.5G.
报错2:PHP版本问题。
这个就对症分析就可以。
注意的是,有时候不是你项目PHP版本不行,而是你
composer的版本没有对应。
报错3:需要更新composer。
composer update
Laravel 出现 No application encryption key has been specified.
首先,我们要看看有没有.env文件,或者.env文件后还追加了.example后缀。
1、.env.example 改名使用命令 copy 修改为 .env。
此时可能还提示缺少了Key。我们使用命令生成。
2、使用命令 php artisan key:generate 获取密码,自动保存到 .env。
命令直接在终端运行就可以。
Composer获取依赖超时
首先判断是否存在这个依赖包。
其次,可能是国外的源,下载超时很正常,我们使用命令将源改为国内的源。
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Composer 升级带来的坑: Undefined index: name
我在部署时也遇到了这个问题,我们可以直接尝试回滚版本或者降低版本,部署上去后再升级回来。
Undefined index: name
如果存在这个报错,那么我们可以这样:
# composer 降级
composer self-update --1
# 再次安装,即可!!!
composer install
或者不需要再次安装,我们直接运行第一句也可以。
composer self-update --1
至于其他方法,不建议,我也就不写了。
版权声明
本文为[小简(JanYork)]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_60750453/article/details/124250973
边栏推荐
- Experience of mathematical modeling in 18 year research competition
- 上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
- 三十.什么是vm和vc?
- Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
- LeetCode 709、转换成小写字母
- 堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
- How do BIM swindlers cheat? (turn)
- DOS command of Intranet penetration
- 一. js的深拷贝和浅拷贝
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
猜你喜欢

Customize timeline component styles

Commit and ROLLBACK in DCL of 16mysql

Three. Based on ply format point cloud voxel model JS upload interface writing
![Es error: request contains unrecognized parameter [ignore_throttled]](/img/17/9131c3eb023b94b3e06b0e1a56a461.png)
Es error: request contains unrecognized parameter [ignore_throttled]

GO语言开发天天生鲜项目第三天 案例-新闻发布系统二

内网渗透之DOS命令

Es keyword sorting error reason = fielddata is disabled on text fields by default Set fielddata = true on keyword in order

內網滲透之DOS命令

DOS command of Intranet penetration

vulnhub DC:1渗透笔记
随机推荐
Identifier CV is not defined in opencv4_ CAP_ PROP_ FPS; CV_ CAP_ PROP_ FRAME_ COUNT; CV_ CAP_ PROP_ POS_ Frames problem
How can matlab obtain the truncated image in trainingimagelabeler
Identification of bolt points in aerial photography based on perception
SQL gets the latest record of the data table
Create vs project with MATLAB
Recognition of high-speed road signs by Matlab using alexnet
Leetcode 542, 01 matrix
Go限制深度遍历目录下文件
GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
UnhandledPromiseRejectionwarning:CastError: Cast to ObjectId failed for value
[matlab 2016 use mex command to find editor visual studio 2019]
LeetCode 1337、矩阵中战斗力最弱的 K 行
The ODB model calculates the data and outputs it to excel
Summary and effect analysis of methods for calculating binocular parallax
Plato Farm元宇宙IEO上线四大,链上交易颇高
Vulnhub DC: 1 penetration notes
Rt-1052 learning notes - GPIO architecture analysis
Some basic knowledge of devexpress report development
Unity ECS dots notes
go slice