刚开始用pecl install v8js 安装,又用如下编译安装,都是出现同样的如下提示。
root@ubuntu:/usr/local/src/v8js-1.3.5# ./configure --with-PHP-config=/usr/local/PHP7/bin/PHP-config checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr/local/PHP7 checking for PHP includes... -I/usr/local/PHP7/include/PHP -I/usr/local/PHP7/include/PHP/main -I/usr/local/PHP7/include/PHP/TSRM -I/usr/local/PHP7/include/PHP/Zend -I/usr/local/PHP7/include/PHP/ext -I/usr/local/PHP7/include/PHP/ext/date/lib checking for PHP extension directory... /usr/local/PHP7/lib/PHP/extensions/no-debug-non-zts-20160303 checking for PHP installed headers prefix... /usr/local/PHP7/include/PHP checking if debug is enabled... no checking if zts is enabled... no checking for re2c... re2c checking for re2c version... 0.13.5 (ok) checking for gawk... gawk checking for V8 Javascript Engine... yes,shared checking for V8 files in default path... not found configure: error: Please reinstall the v8 distribution
然后试着安装apt-get install libv8-dev 后,继续,如下
root@ubuntu:/usr/local/src/v8js-1.3.5# ./configure --with-PHP-config=/usr/local/PHP7/bin/PHP-config checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,shared checking for V8 files in default path... found in /usr checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for C standard version... c++11 checking how to allow c++11 narrowing... checking for libv8_libplatform... checking for libv8_libplatform... configure: error: could not find libv8_libplatform library
die
看文档,可能是libv8库版本过低,
V8 Javascript Engine library (libv8) master https://github.com/v8/v8-git-mirror (trunk) V8 is Google's open source Javascript engine. V8 is written in C++ and is used in Google Chrome,the open source browser from Google. V8 implements ECMAScript as specified in ECMA-262,5th edition. This extension requires V8 4.6.76 or higher. V8 releases are published rather quickly and the V8 team usually provides security support for the version line shipped with the Chrome browser (stable channel) and newer (only). For a version overview see https://omahaproxy.appspot.com/. PHP 7.0.0+ This embedded implementation of the V8 engine uses thread locking so it works with ZTS enabled.
安装libv8最新版(5以上)(库地址:https://launchpad.net/~pinepain)
sudo add-apt-repository ppa:pinepain/libv8-5.2 sudo apt-get update
卸载原先的libv8-dev,执行apt-get install libv8-5.2-dev
nice
Build process completed successfully Installing '/usr/lib/PHP5/20121212/v8js.so' install ok: channel://pecl.PHP.net/v8js-0.6.4 configuration option "PHP_ini" is not set to PHP.ini location You should add "extension=v8js.so" to PHP.ini
PHP7也安装成功
root@ubuntu:/etc/PHP5/fpm/conf.d# /usr/local/PHP7/bin/pecl install v8js
Build process completed successfully Installing '/usr/local/PHP7/lib/PHP/extensions/no-debug-non-zts-20160303/v8js.so' install ok: channel://pecl.PHP.net/v8js-1.3.5 configuration option "PHP_ini" is not set to PHP.ini location You should add "extension=v8js.so" to PHP.ini原文链接:https://www.f2er.com/ubuntu/354094.html