Last active
February 2, 2017 14:28
-
-
Save auroraeosrose/0a1447e493cf5bc5fe73574d05a4893c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PHP Extensions Tutorial | |
The best way to learn about writing extensions is - to write an | |
extension! If you want to "code along", you'll need to be set up to | |
compile PHP 7 extensions, have a checkout of the example code we'll be | |
using, and have the C library we'll be "wrapping" available on your | |
system. | |
All the code we'll be working with is available from | |
https://github.com/auroraeosrose/php-extensions-code | |
The library we'll be using is http://uriparser.sourceforge.net/ - it | |
compiles easily "out of the box" and is available on some systems | |
packaging | |
sudo apt-get install liburiparser-dev on ubuntu | |
You will need a compile environment for your system. That means | |
autoconf, make, gcc at minimum. You CAN do this on windows, but | |
setting up a compile environment is much harder (if you're going that | |
route, hit me up in #phpmentoring on irc.freenode.org and I can walk | |
you through an installation) | |
You'll also need a PHP 7 install with headers and phpize - this can | |
come from a "from scratch" build of PHP or from a binary with dev | |
packages. | |
Setting up a compile environment can vary wildly and is highly | |
dependent on users systems and likes. | |
If you want to bypass all the hard stuff, and use virtualbox the | |
recommended way is to just download | |
https://github.com/rlerdorf/php7dev | |
which will give you a nicely set up vagrant/virtualbox with everything you need | |
For those who are more ambitious: | |
On a mac: https://gist.github.com/denji/8e50fcb13482c5d6c78a | |
homebrew is recommended to get un-messed up headers and libraries | |
An install of php7 from the dotdeb or Ondřej Surý's PPA: will work as well | |
https://www.colinodell.com/blog/2015-12/installing-php-7-0-0 | |
TL;DR | |
install https://github.com/rlerdorf/php7dev | |
ssh into it | |
sudo apt-get install liburiparser-dev | |
git clone https://github.com/auroraeosrose/php-extensions-code.git | |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment