问题
I've tried to install composer for my CodeIgniter project.
The installation was successful. But, when I type on command-line composer --version
, it shows:
PHP temp directory (C:\Users\petik\AppData\Local\Temp) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini
Composer version 1.4.2 2017-05-17 08:17:52
Can anyone help?
回答1:
Change TEMP folder in php.ini. look for entry sys_temp_dir
in your php.ini file and change the tmp location and set correct permissions.
回答2:
Or if you use Windows you have to run your command line like an administrator "Run as administrator"
回答3:
I have same error on an debian where /tmp partition was full. Purge rm -rf /tmp/*
, and message gone. May this help.
回答4:
For this error, If you don't have permission to edit php.ini file. My temporary solution is:
php -d open_base_dir="." -d sys_temp_dir="." /usr/local/bin/composer -v
You can run all your composer commands like this:
php -d open_base_dir="." -d sys_temp_dir="." /usr/local/bin/composer install
php -d open_base_dir="." -d sys_temp_dir="." /usr/local/bin/composer update
You can also use this command in other operations e.g.: In magento2 for phpcbf:
php -d open_base_dir="." -d sys_temp_dir="." vendor/bin/phpcbf --standard=Magento2 magento2/app/code/example/StockReserve --report-file="StockReserveAutoFixed.txt"
php -d sets variable in command line.
来源:https://stackoverflow.com/questions/44426387/message-set-sys-temp-dir-in-your-php-ini-after-installed-composer