缓存 接入Lavarel 启用交换区Swap
![](https://images2015.cnblogs.com/blog/1069155/201707/1069155-20170709085412962-260675664.png)
#php artisan --version
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/html/github/laravel/artisan on line 31
[root@iZ288qf4d1yZ laravel]# php -v
PHP 5.4.16 (cli) (built: Aug 11 2016 21:24:59)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
我升级php版本
#rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
#rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# yum remove php-common
# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
# php artisan --version
PHP Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
Laravel Framework version 5.2.22
[root@iZ288qf4d1yZ laravel]# free
total used free shared buff/cache available
Mem: 1015476 200040 149560 32592 665876 600280
Swap: 0 0 0
创建一个新用户
[root@localhost ~]# adduser zhangbiao
[root@localhost ~]# passwd zhangbiao
Username for 'https://github.com': pretty_c_a_t@sina.com
Password for 'https://pretty_c_a_t@sina.com@github.com':
git config --global user.email "xxx"
git config --global user.name "xxx"
密码是github的密码
![](https://images2015.cnblogs.com/blog/1069155/201707/1069155-20170709105824775-966497649.png)
[root@iZ288qf4d1yZ github]# chmod -R 777 laravel/
root@iZ288qf4d1yZ github]# chmod -R 777 laravel/
[root@iZ288qf4d1yZ github]# su yanghaiyan
[yanghaiyan@iZ288qf4d1yZ github]$ cd laravel/
[yanghaiyan@iZ288qf4d1yZ laravel]$ composer install
PHP Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
PHP Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
> php artisan optimize
PHP Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
Generating optimized class loader
Compiling common classes
[yanghaiyan@iZ288qf4d1yZ laravel]$
okay 了
接入redis文件
如何启用linux swap (安装redis时内存不够 启用交换区)
-
- 一定要在根目录
-
dd if=/dev/zero of=/swap bs=1M count=1024
-
mkswap -f /swap
-
swapon /swap
-
free
取自 http://www.cnblogs.com/zsummer/p/4808422.html
创建步骤:
1.创建swap交换区硬盘存储用的空白文件。
1 2 |
#创建一个1个G的SWAP交换区空白文件 dd if=/dev/zero of=/swap bs=1M count=1024 |
通常创建物理内存2~2.5倍大小的文件作为交换区。
2.使用mkswap格式化文件为swap文件系统
1 2 |
mkswap -f /swap #-f 使用文件作为swap交换区 |
3.启用刚才创建的Swap文件
1 |
swapon /swap |
4.如果有必要可以设置开机自动启用swap文件交换区,修改/etc/fstab,增加一行
1 |
/swap swap swap defaults 0 0 #启动即启用swap |
5.如果不需要启用swap或需要调整swap大小,可以使用swapoff命令关闭swap。
1 |
swapoff /swap |
关闭swap后删除对应的swap文件即可删除swap交换区,如需要调整swap交换区大小,从第一部开始重新创建即可。
安装memcached
brew search memcache
brew install memcached
which memcached
memcached -h
memcached 1.4.15