简体   繁体   English

Laravel-在实时服务器上安装与Composer一起安装的软件包

[英]Laravel - Installing packages that were installed with composer on live server

I have a laravel project on namecheap shared server, I have set up everything and it is working there. 我有namecheap共享服务器上的laravel项目,我已经设置了一切,这是在那里工作。 But after that, I have added locally on my machine to the project imagecache intervention package with composer. 但是之后,我已经在本地计算机上使用composer将其添加到项目imagecache intervention包中。 I don't know how to install it on the server though, I have tried with running composer commands through ssh: 我不知道如何在服务器上安装它,我尝试通过ssh运行composer命令:

php composer require intervention/imagecache 

But I got an error: 但我得到一个错误:

Could not open input file: composer 无法打开输入文件:作曲家

Since, their support told me that they actually have composer uploaded in the folder public_html and not where my project is and that is public_html/myProject if that is the problem. 从那以后,他们的支持告诉我他们实际上已经在文件夹public_html上传了作曲家,而不是在我的项目所在的位置,如果有问题,那就是public_html/myProject Since I have no idea, how the composer is installed and setup there, I wonder how can I install this package. 由于我不知道如何在这里安装和设置作曲家,所以我想知道如何安装此软件包。 I have also tried by just uploading the whole directory of the package from my local vendor folder in the project to the production server, but that didn't work either, images were still not visible when I was using imagecache route. 我还尝试了将软件包的整个目录从项目中的本地供应商文件夹上载到生产服务器的尝试,但是那也不起作用,当我使用图像imagecache路由时,图像仍然不可见。 How can I fix that? 我该如何解决?

Run this: php -c php.ini composer.phar install 运行此命令: php -c php.ini composer.phar install

First You have to create php.ini file with this info. 首先,您必须使用此信息创建php.ini文件。

max_execution_time = 300 
max_input_time = 300 
memory_limit = 512M 
suhosin.executor.include.whitelist = phar 
detect_unicode = Off

If you have ssh then you can create a folder where ever you wan't. 如果您有ssh,则可以在不希望使用的位置创建一个文件夹。 It is better if you put it in the same level that your public folder and then install composer inside this folder: 最好将其放在与公用文件夹相同的级别,然后在该文件夹中安装composer:

with curl 卷曲

curl -sS https://getcomposer.org/installer | php

if you don't have curl or the server has restrictions you can use: 如果您没有卷曲或服务器有限制,则可以使用:

php -r "readfile('https://getcomposer.org/installer');" | php

or you can "Manual Download" the composer.phar and upload it trough ftp 或者,您可以“手动下载” composer.phar并通过ftp上传

https://getcomposer.org/download/ https://getcomposer.org/download/

Then you need to give execution rights to the composer.phar file and you 然后,您需要授予composer.phar文件的执行权限,

chmod a+x composer.phar

can also create an alias to run composer from your public folder 也可以创建别名以从您的公用文件夹运行作曲家

alias composer="path/to/composer/composer.phar"

This alias will work until you close your console. 该别名将起作用,直到您关闭控制台为止。 In some shared servers you will see a file call: .bashrc where you can put the alias 在某些共享服务器中,您将看到一个文件调用:.bashrc,您可以在其中放置别名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM