yum install v8-devel
wget https://pecl.php.net/get/v8js-0.1.3.tgz --no-check-certificate
tar zxvf v8js-0.1.3.tgz
cd v8js-0.1.3
phpize
./configure --with-php-config=/usr/bin/php-config --with-v8js
make && make install
如果make时报错,需要修改v8js.cc文件 ‘PHP_V8_VERSION’ was not declared in this scope
vi v8js.cc
在前方define处加入
#define PHP_V8_VERSION "0.1.3"
记得引号不能少
安装成功后会提示:
Installing shared extensions: /usr/lib64/php/modules/
v8js.so在这个目录下了
vi /etc/php.ini
添加一行:
extension = "v8js.so"
重启apache,phpinfo中即可看到v8相关信息,确认安装成功!
网友评论