Skip to main content

How to install V8js for Php on Mac OS X

I recently had interest in generating a React-based web app using PHP. To be able to do such an amazing thing you first need to install the PHP extension V8Js. You’ll find below the process I followed to install it on my Mac:
First install the engine:
brew install v8
Install dependency for the PECL Extension:
brew install autoconf
Update Pear:
cd /usr/lib/php
sudo php install-pear-nozlib.phar
Then edit your php.ini by adding the following line next existing include_path if not already there
include_path = ".:/usr/lib/php/pear"
Update/Upgrade Pear / PECL
sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all
Grab V8Js PECL Extension from github & install it
cd ~
mkdir tmp && cd tmp
git clone git@github.com:preillyme/v8js.git
cd v8js
phpize
./configure CXXFLAGS="-Wno-c++11-narrowing"
make
make test # if this step fails you can try make install anyway, should work.
make install
Then edit your php.ini again to add the following line:
extension=v8js.so
All you need to do now is to restart Apache and it should work !
sudo apachectl restart
I can’t guarantee it’ll work for everyone, especially that it might be time sensitive given the compatibility between versions. Hopefully it’ll help some of you 🙂

Comments

Post a Comment

Popular posts from this blog

how to inform website owner about broken links

The first step in broken link building is to find broken links. Pick a particular domain: Chances are there’re a few authority sites in your niche that you’re dying to get a link from, but maybe you can’t find your “in.” This is a perfect opportunity for broken link building. Once you find broken links find contact information of site owner and send mail and inform that there website is have broken links and ask them to replace the broken link with your link.

Awesome Thing About PHP Most of People Don't Know

Extract is your friend.  Ever been in the situation where you need to say something like: <?php $name = $array['name']; $surname = $array['surname']; $message = $array['message']; Then you may want to recall that you can use extract() to do the same. Put simply, extract will remove the work behind this. In this case, saying: <?php extract($array); Will automatically make $name = $array['name']; So, you can say "hello ".$name." ".$surname." Without do all of the declarations. Of course, you always need to be mindful of validation and filtering, but there is a right way and a wrong way to do anything with PHP.