The previous log records the windows installation and use of composer.
This log records the Linux installation and use of composer, let me talk about tongue twisters...
Relatively speaking, I still prefer to use linux, although I don't understand it.
start installation:
1: Download the composer package:
curl -sS https://getcomposer.org/installer | php
Error content:
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The suhosin.executor.include.whitelist setting is incorrect.
Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):
suhosin.executor.include.whitelist = phar
The php.ini used by your command-line PHP is: /etc/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.
The reason for the error is that my php has installed the suhosin extension. The solution is given in the error report, which is to add it to the php.ini file
suhosin.executor.include.whitelist = phar
2: Install Composer
mv composer.phar /usr/local/bin/composer
3: Check whether the installation of Composer is successful
composer -v
4: Set up China mirror
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Error:
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Reason for the error: It is not possible to run composer as the root user.
Explanation given on the official website:
https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md The
solution is easy, add another user to your server and use the new user to operate composer
5: Install thinkphp5.1
composer create-project topthink/think tp5
Error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3194636 bytes) in phar:///usr/local/bin/composer/src/Composer/Cache.php on line 94
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3194636 bytes) in phar:///usr/local/bin/composer/src/Composer/Cache.php on line 94
Solution:
The terminal reported the Allowed memory size of 134217728 bytes exhausted error, because the default memory limit of php is 128M, so you need to modify the php.ini file.
1. Find the line memory_limit = 128M, change 128M to a larger size, and I directly changed it to 2048M here.
2. Restart apache
3. Re-execute the php file, success, OK
The update method is the same as windows
Enter the application root directory and execute:
composer update topthink/framework
The update operation will delete the thinkphp directory and download and install the new version again, but it will not affect the application directory, so do not add any application code and class libraries to the core framework directory.
The directory where the installation and update commands are located is different, and the update must be performed under the root directory of your application
Have a good suggestion, please enter your comment below.
Welcome to the personal blog
https://guanchao.site
Welcome to the Mini Program: