Message: Set sys_temp_dir in your php.ini after installed composer

与世无争的帅哥 提交于 2021-02-10 06:07:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!