如果要使用安裝 PHP7.1+Laravel Composer+MongoDB.可以這樣安裝~
(1)安裝 PHP7.1
# yum install php71*
(2)安裝 composer
# curl -sS https://getcomposer.org/installer | sudo php
# mv composer.phar /usr/local/bin/composer
# ln -s /usr/local/bin/composer /usr/bin/composer
(3)安裝Laravel mongodb Driver
# yum install php7-pear php7-devel gcc openssl-devel git
# pecl7 install mongodb
# echo "extension=mongodb.so" > /etc/php.d/mongodb.ini
在Laravel項目中安裝swagger-php:
# composer require zircote/swagger-php
(4)安裝mongodb 3.4 server
請建立 /etc/yum.repos.d/mongodb-org-3.4.repo 檔案,並加入以下內容:
QUOTE:
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
# yum install mongodb-org mongodb-org-server
啟動 mongod service
# service mongod start
這樣就可以囉~~
安裝過程有出現一些狀況...可以這樣解~
問題(一):
Laravel composer install 出現這個問題:
PHP Composer update “cannot allocate memory” error (using Laravel 5.3)
proc_open() fork failed - cannot allocate memory composer
解法(增加swap空間):
# /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
# /sbin/mkswap /var/swap.1
# /sbin/swapon /var/swap.1
問題(二): 幫 git 加上 Auto Complete
# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
Next, add the following lines to your .bash_profile.
QUOTE:
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
參考文章:
https://stackoverflow.com/questions/18116261/php-composer-update-cannot-allocate-memory-error-using-laravel-4
http://code-worrier.com/blog/autocomplete-git/