Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if there is no response to any command in Composer?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what to do if you don't respond to any Composer commands. I hope you will get something after reading this article. Let's discuss it together.

Environment

CentOS 7

Nginx 1.12.0

PHP 7.1.6

problem

The original use is normal, because I need to create a new project, I use Composer to create, but there is no display, followed by the implementation of the creation of other projects have no response. After adding the-vvv option, the result is also unchanged, and then you try to execute composer-h, composer self update, and so on, without any prompts.

After another Composer-related command is executed, echo $? is executed, and the result is 255.

When I tried to install Composer, there was an error about open_basedir, and I immediately knew what the problem was. Before I created the new project, I configured the open_basedir option of php.ini. The value is the project directory and the working directory of / tmp/,Composer is the project directory.

After commenting open_basedir and restarting PHP, there was no problem with the use of Composer. But I still want to set up open_basedir, and here's the answer.

Use Nginx

Both external request server parsing and terminal PHP commands will take the php.ini file, but the execution of Composer is local to the system. That is, if you set it from Nginx, the local execution of Composer will not be affected.

Nginx add configuration

Fastcgi_param PHP_ADMIN_VALUE "open_basedir= Project Directory /: / tmp/"

After restarting Nginx and PHP, there is no exception when attempting to execute Composer in the terminal. There are two things to note about the configuration of open_basedir in Nginx configuration.

If your program is a framework, it is not recommended to write $document_root/, because that is the root value, and this value is the directory of the frame's entry, which is bound to go wrong. If you understand, you can also write $document_root/, but don't forget to add the directory of the entire site.

Remember to add "/" at the end of the directory, for example, write "/ tmp/" instead of "/ tmp". If you write "/ tmp", then "/ tmp1" is also allowed.

I just want to use php.ini.

It is obvious that the implementation of the Composer command requires a directory not only in the project directory (which is also the working directory where I execute the Composer command) and the tmp directory, but also in the search for relevant information without results. Finally, I sorted out the train of thought. After the original value of php.ini open_basedir added the directory where the Composer command is located and the file directory of Composer, it is normal to restart PHP,Composer.

After reading this article, I believe you have a certain understanding of "what to do without responding to any Composer command". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report