下面由composer教程欄目帶大家介紹Composer安裝及解決遇到的問(wèn)題 ,希望對(duì)需要的朋友有所幫助!
類(lèi)庫(kù)查找網(wǎng)站 :https://packagist.org/
Composer中文網(wǎng):https://www.phpcomposer.com/
安裝Composer
在這之前,先檢查你的php版本和相關(guān)擴(kuò)展
1.php>=5.6
2.OpenSSL擴(kuò)展是否配置完成
3.Composer安裝包以及OpenSSL所需要的證書(shū)下載地址
4.下載完成后,打開(kāi)安裝程序,跟著步驟走就行。
5.中間選擇路徑要選擇你要使用的php版本的php.exe文件
6.如果安裝遇到問(wèn)題下載失敗,多試幾遍即可。
如果你的OpenSSL擴(kuò)展沒(méi)有配置的話,就可能會(huì)產(chǎn)生以下錯(cuò)誤:
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 openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with –with-openssl
解決方法:
1.在php的安裝目錄比如說(shuō)D:wampbinphpphp5.6中,找到找個(gè)目錄下的php.ini文件,然后去掉 extension=php_openssl.dll 這一行開(kāi)頭的注釋。注意:因?yàn)镾SL連接需要認(rèn)證,所以繼續(xù)下面的步驟之前,需要準(zhǔn)備好CA證書(shū)(建議證書(shū)保存到php的相關(guān)目錄中),可以從https://curl.haxx.se/docs/caextract.html處下載。也可以從上面步驟3中下載。
2。修改php.ini文件中的openssl.cafile。在php文件夾中創(chuàng)建一個(gè)ssl文件夾,里面放入證書(shū)后,修改php.ini文件,openssl.cafile=”D:phpStudyphpsslcacert.pem”,最后重啟下php環(huán)境,應(yīng)該就能安裝上了。