wget https://pecl.php.net/get/v8js-2.1.0.tgz
tar -xvf v8js-2.1.0.tgz
cd v8js-2.1.0
phpize
./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS" --with-php-config=/www/server/php/72/bin/php-config
复制modules目录下的v8js.so
/www/server/php/72/lib/php/extensions/no-debug-non-zts-*
最后在PHP配置文件中增加
extension = /www/server/php/72/lib/php/extensions/no-debug-non-zts-*/v8js.so
<?php
$v8 = new V8Js();
$v8->executeString('console.log("V8JS compile success");')?
>
Last modification:June 19, 2026
© Allow specification reprint
