Recently interested in the V8 JavaScript engine, found that PHP has a v8js extension, on its own MacBook Air mounted a play, recording the installation process.
1. Install V8 Javscript engine. Follow the instructions on the wiki http://code.google.com/p/v8/wiki/BuildingWithGYP on the V8, and there is basically nothing wrong with that.
SVN checkout V8 source code
$SVN Checkout Http://v8.googlecode.com/svn/trunk/v8
$CD V8
This version of V8 needs to be installed with Gyp, not knowing what it is, but just the following command
$make dependencies
Native indicates that the release version of the current system is compiled, and library=shared indicates that the dynamic link library is compiled
$make native library=shared
Copy the included files and out directories under the V8 directory to the system directory
$sudo CP include/*/usr/local/include
$sudo CP out/native/*/usr/local/lib
2.mac default PHP installation no pear, but with the installation file, run it and put Pear
$CD/usr/lib/php
$sudo PHP Install-pear-nozlib.phar
3. Install V8JS, I install the version is the beta version need to add channel
sudo pecl install V8js channel://pecl.php.net/v8js-0.1.3
4. Modify PHP.ini plus extension=v8js.so
Write a simple test file
? Php
$v 8 = new V8js ();
$js = "Print (' Hello World ');";
$v 8-> executestring ($JS); This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20130528/38092.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.