{"description":"Download and install [Virtualbox](https://www.virtualbox.org/wiki/Downloads)\r\n\r\nDownload and install [Vagrant](https://www.vagrantup.com/downloads.html)\r\n\r\n```\r\n$ vagrant box add php7dev rasmus/php7dev\r\n...\r\n$ vagrant init php7dev\r\n...\r\n$ vagrant up\r\n...\r\n(You can ignore the warning about the guest additions version)\r\n...\r\n$ vagrant ssh\r\n```\r\n\r\nIf everything went well you should now be ssh'ed into your php7dev\r\nenvironment. \r\n\r\nHowever, you will notice if you do:\r\n\r\n```\r\n$ /sbin/ifconfig\r\n```\r\n\r\nThat your network interface is a private NAT'ed ip. You can get out\r\nfrom it, but you can't get in. Log back out (^D) and edit your ~/Vagrantfile\r\nMost of it is commented out. Find the section that says config.vm.network\r\nand add:\r\n\r\n```\r\nconfig.vm.network \"public_network\", type: \"dhcp\"\r\n```\r\n\r\nThen:\r\n\r\n```\r\n$ vagrant reload\r\n```\r\n\r\nIt will ask you which interface to bridge to. Select your current active\r\nnetwork interface and it should just work. Go back in and check which ip\r\nyou got:\r\n\r\n```\r\n$ vagrant ssh\r\n\r\nvagrant@php7dev:~$ /sbin/ifconfig eth1\r\neth1 Link encap:Ethernet HWaddr 08:00:27:f3:4d:5f\r\n inet addr:192.168.200.13 Bcast:192.168.200.255 Mask:255.255.255.0\r\n inet6 addr: fe80::a00:27ff:fef3:4d5f/64 Scope:Link\r\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\r\n RX packets:212 errors:0 dropped:0 overruns:0 frame:0\r\n TX packets:157 errors:0 dropped:0 overruns:0 carrier:0\r\n collisions:0 txqueuelen:1000\r\n RX bytes:23170 (22.6 KiB) TX bytes:197139 (192.5 KiB)\r\n```\r\n\r\nI got 192.168.200.13 from my dhcp server here which means you can open\r\nup a browser on any computer on your network and access **http://192.168.200.13**\r\nand you should see the PHP7 phpinfo() page.\r\n\r\nNow you can install something. The sites live in */var/www*.\r\n\r\nFor example, to install phpBB:\r\n\r\n```\r\n$ cd /var/www\r\n$ wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip\r\n...\r\n$ unzip phpBB-3.1.2.zip\r\n...\r\n$ sudo chown -R www-data phpBB3\r\n```\r\n\r\nNow create */etc/nginx/conf.d/phpbb.conf* with this config:\r\n\r\n```\r\nserver {\r\n listen 80;\r\n server_name phpbb;\r\n root /var/www/phpBB3;\r\n index index.php index.html index.htm;\r\n access_log /var/log/nginx/phpbb-access.log;\r\n error_log /var/log/nginx/phpbb-error.log;\r\n\r\n location ~ /(config\\.php|common\\.php|cache|files|images/avatars/upload|includes|store) {\r\n deny all;\r\n return 403;\r\n }\r\n\r\n location ~* \\.(gif|jpe?g|png|css)$ {\r\n expires 30d;\r\n }\r\n\r\n include php.conf;\r\n}\r\n```\r\n\r\nYou will need to sudo to do it. It shouldn't ask you for a password,\r\nbut every password, sudo, root, mysql is set to: vagrant\r\nin case you need it.\r\n\r\nThen do:\r\n\r\n```\r\n$ sudo service nginx reload\r\n```\r\n\r\nOn the machine you are running your web browser, add an entry to your */etc/hosts* file with:\r\n\r\n```\r\n 192.168.200.13 phpbb\r\n```\r\n\r\nSubstitute your ip there, of course.\r\n\r\nNow you can go to **http://phpbb/** and you should be redirected to the phpBB installer.\r\n\r\nBefore you start, you need to create the database:\r\n\r\n```\r\n$ mysqladmin create phpbb\r\n```\r\n\r\nNow go through the steps. Your Database host is just localhost and the user\r\nis vagrant, password vagrant. Database name is phpbb. You can leave the port empty.\r\nClick through the rest and you should be done. Then remove the install directory to\r\nget rid of the annoying warning:\r\n\r\n```\r\n$ sudo rm -rf /var/www/phpBB3/install/\r\n```\r\n\r\nFor the most part installing almost anything follows the same pattern. Download the\r\ntarball or zip file to /var/www. Extract, make it owned by www-data and find the\r\nnginx server config. Usually a quick google search will turn it up. If it doesn't,\r\nsomething like:\r\n\r\n```\r\n server {\r\n listen 80;\r\n server_name mysite;\r\n root /var/www/mysite;\r\n access_log /var/log/nginx/mysite-access.log;\r\n error_log /var/log/nginx/mysite-error.log;\r\n\r\n index index.php index.html;\r\n\r\n location / {\r\n try_files $uri $uri/ @rewrite;\r\n }\r\n location @rewrite {\r\n rewrite ^(.*)$ /index.php;\r\n }\r\n\r\n include php.conf;\r\n }\r\n```\r\n\r\nUsually does the trick.\r\n\r\nComposer is installed (in */usr/local/bin*) for the packages that need it.\r\nYou also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, \r\nPHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with\r\nPHP 7 running, but to switch to 5.6 temporarily:\r\n\r\n```\r\n$ sudo service php-fpm stop\r\n$ sudo service php56-fpm start\r\n```\r\n\r\nSimilarly, from the command line you can run **php56**.\r\n\r\nFor debugging, you have many options. Valgrind is installed and the suppressions\r\nfile is up to date. I have included a helper script I use called memcheck.\r\nTry it:\r\n\r\n```\r\n$ memcheck php -v\r\n==3788== Memcheck, a memory error detector\r\n==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\r\n==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\r\n==3788== Command: php -v\r\n==3788==\r\nPHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)\r\nCopyright (c) 1997-2015 The PHP Group\r\nZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies\r\n with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies\r\n==3788==\r\n==3788== HEAP SUMMARY:\r\n==3788== in use at exit: 19,112 bytes in 17 blocks\r\n==3788== total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated\r\n==3788==\r\n==3788== LEAK SUMMARY:\r\n==3788== definitely lost: 0 bytes in 0 blocks\r\n==3788== indirectly lost: 0 bytes in 0 blocks\r\n==3788== possibly lost: 0 bytes in 0 blocks\r\n==3788== still reachable: 0 bytes in 0 blocks\r\n==3788== suppressed: 19,112 bytes in 17 blocks\r\n==3788==\r\n==3788== For counts of detected and suppressed errors, rerun with: -v\r\n==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)\r\n```\r\n\r\nAlso, sometimes it is easier to track down issues with a single standalone\r\nprocess instead of using php-fpm. You can do this like this:\r\n\r\n```\r\n$ sudo service php-fpm stop\r\n$ sudo php-cgi -b /var/run/php-fpm.sock\r\n```\r\n\r\nThe debug build will report memory leaks and you can of course run it\r\nunder gdb or valgrind as well. See the /usr/local/bin/memcheck script\r\nfor how to run Valgrind.\r\n\r\nTo update php7 to the latest, do this:\r\n\r\n```\r\n$ cd php-src\r\n$ git pull -r\r\n$ make distclean\r\n$ ./buildconf -f\r\n$ ./cn\r\n$ make\r\n$ sudo make install\r\n$ sudo service php-fpm restart\r\n```\r\n\r\nIf something isn't working or you have suggestions, please let me know.","short_description":"PHP 7 Testing and Development","name":"rasmus/php7dev","versions":[{"version":"1.0.0","status":"active","description_html":"
See https://github.com/rlerdorf/php7dev/
\n","description_markdown":"See https://github.com/rlerdorf/php7dev/","providers":[{"name":"virtualbox","checksum":null,"checksum_type":null,"url":"https://vagrantcloud.com/rasmus/boxes/php7dev/versions/1.0.0/providers/virtualbox/unknown/vagrant.box"}]},{"version":"0.1.0","status":"active","description_html":"See https://github.com/rlerdorf/php7dev
\n","description_markdown":"See https://github.com/rlerdorf/php7dev","providers":[{"name":"virtualbox","checksum":null,"checksum_type":null,"url":"https://vagrantcloud.com/rasmus/boxes/php7dev/versions/0.1.0/providers/virtualbox/unknown/vagrant.box"}]},{"version":"0.0.9","status":"active","description_html":"See https://github.com/rlerdorf/php7dev
\n","description_markdown":"See https://github.com/rlerdorf/php7dev","providers":[{"name":"virtualbox","checksum":null,"checksum_type":null,"url":"https://vagrantcloud.com/rasmus/boxes/php7dev/versions/0.0.9/providers/virtualbox/unknown/vagrant.box"}]},{"version":"0.0.8","status":"active","description_html":"See https://github.com/rlerdorf/php7dev/blob/master/README.md
\n\nChangelog:
\n\n0.0.2:
\n\n0.0.1 Initial release
\n\nDownload and install Virtualbox
\n\nDownload and install Vagrant
\n\nMake sure you are at least at Vagrant version 1.5 or the steps below may not work for you.
\n\nThen from a terminal, do:
\n\n$ vagrant box add rasmus/php7dev\n...\n$ vagrant init rasmus/php7dev\n...\n$ vagrant up\n...\n(You can ignore the warning about the guest additions version)\n...\n$ vagrant ssh\n
\n\nIf everything went well you should now be ssh'ed into your php7dev\nenvironment.
\n\nHowever, if you check /sbin/ifconfig you will see that your network interface is a private NAT'ed ip. You can get out from it, but you can't get in. Log back out and edit your ~/Vagrantfile.\nMost of it is commented out. Find the section that says config.vm.network and add:
\n\nconfig.vm.hostname = "php7dev"\nconfig.vm.network "public_network", type: "dhcp"\n
\n\nThere are also various vagrant plugins that can help you update your dns. See local-domain-resolution.
\n\nThe landrush one looks interesting since it could be used to create a local php7dev domain and you could then just make all your vhosts myvhost.php7dev and you wouldn't need to edit your /etc/hosts file every time you added a new vhost.
\n\n$ vagrant reload\n
\n\nIt will ask you which interface to bridge to. Select your current active network interface and it should just work. If you have configured one of the domain resolution plugins you should be set to go now, otherwise, vagrant ssh in and check the ip manually and add it to your /etc/hosts file. Then try it from your browser:
\n\nhttp://php7dev/\n
\n\nIt should show the PHP7 phpinfo() page.
\n\nThis also means you don't need to use vagrant ssh anymore. You can just ssh directly into the machine like any other machine on your network at this point.
\n\nNow you can install something. The sites live in /var/www.
\n\nFor example, to install phpBB:
\n\n$ cd /var/www\n$ wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip\n...\n$ unzip phpBB-3.1.2.zip\n...\n$ sudo chown -R www-data phpBB3\n
\n\nNow create /etc/nginx/conf.d/phpbb.conf with this config:
\n\nserver {\n listen 80;\n server_name phpbb;\n root /var/www/phpBB3;\n index index.php index.html index.htm;\n access_log /var/log/nginx/phpbb-access.log;\n error_log /var/log/nginx/phpbb-error.log;\n\n location ~ /(config\\.php|common\\.php|cache|files|images/avatars/upload|includes|store) {\n deny all;\n return 403;\n }\n\n location ~* \\.(gif|jpe?g|png|css)$ {\n expires 30d;\n }\n\n include php.conf;\n}\n
\n\nYou will need to sudo to do it. It shouldn't ask you for a password,\nbut every password, sudo, root, mysql is set to: vagrant\nin case you need it.
\n\nThen do:
\n\n$ sudo service nginx reload\n
\n\nOn the machine you are running your web browser, add an entry to your /etc/hosts file with:
\n\n192.168.x.x phpbb\n
\n\nSubstitute your ip there, of course.
\n\nNow you can go to http://phpbb/ and you should be redirected to the phpBB installer.
\n\nBefore you start, you need to create the database:
\n\n$ mysqladmin create phpbb\n
\n\nNow go through the steps. Your Database host is localhost and the user is vagrant, password vagrant. Database name is phpbb. You can leave the port empty. Click through the rest and you should be done. Then remove the install directory to get rid of the annoying warning:
\n\n$ sudo rm -rf /var/www/phpBB3/install/\n
\n\nFor the most part installing almost anything follows the same pattern. Download the tarball or zip file to /var/www. Extract, make it owned by www-data and find the nginx server config. Usually a quick Google search will turn it up. If it doesn't, something like:
\n\n server {\n listen 80;\n server_name mysite;\n root /var/www/mysite;\n access_log /var/log/nginx/mysite-access.log;\n error_log /var/log/nginx/mysite-error.log;\n\n index index.php index.html;\n\n location / {\n try_files $uri $uri/ @rewrite;\n }\n location @rewrite {\n rewrite ^(.*)$ /index.php;\n }\n\n include php.conf;\n }\n
\n\nUsually does the trick.
\n\nComposer is installed (in /usr/local/bin) for the packages that need it. You also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with PHP 7 running, but to switch to 5.6 temporarily:
\n\n$ sudo service php-fpm stop\n$ sudo service php56-fpm start\n
\n\nSimilarly, from the command line you can run php56.
\n\nFor debugging, you have many options. Valgrind is installed and the suppressions file is up to date. I have included a helper script I use called memcheck. Try it:
\n\n$ memcheck php -v\n==3788== Memcheck, a memory error detector\n==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\n==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\n==3788== Command: php -v\n==3788==\nPHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)\nCopyright (c) 1997-2015 The PHP Group\nZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies\n with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies\n==3788==\n==3788== HEAP SUMMARY:\n==3788== in use at exit: 19,112 bytes in 17 blocks\n==3788== total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated\n==3788==\n==3788== LEAK SUMMARY:\n==3788== definitely lost: 0 bytes in 0 blocks\n==3788== indirectly lost: 0 bytes in 0 blocks\n==3788== possibly lost: 0 bytes in 0 blocks\n==3788== still reachable: 0 bytes in 0 blocks\n==3788== suppressed: 19,112 bytes in 17 blocks\n==3788==\n==3788== For counts of detected and suppressed errors, rerun with: -v\n==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)\n
\n\nAlso, sometimes it is easier to track down issues with a single standalone process instead of using php-fpm. You can do this like this:
\n\n$ sudo service php-fpm stop\n$ sudo php-cgi -b /var/run/php-fpm.sock\n
\n\nThe debug build will report memory leaks and you can of course run it\nunder gdb or valgrind as well. See the /usr/local/bin/memcheck script\nfor how to run Valgrind.
\n\nTo update php7 to the latest, do this:
\n\n$ cd php-src\n$ git pull -r\n$ make distclean\n$ ./buildconf -f\n$ ./cn\n$ make\n$ sudo make install\n$ sudo service php-fpm restart\n
\n\nIt should be quite fast because ccache is installed and the cache should be relatively recent.
\n\nYou will also find a .gdbinit symlink in ~vagrant which provides a number of useful gdb macros. The symlink into php-src should ensure you have the right set for the current checked out version of the code.
\n\nAnd a tiny apt primer:
\n\nIf something isn't working or you have suggestions, please let me know.
\n","description_markdown":"# Changelog\r\n\r\n0.0.2:\r\n- Upgraded VirtualBox Guest Additions to version 4.3\r\n- Added curl\r\n- pulled and built latest php7 from master\r\n\r\n0.0.1 Initial release\r\n\r\n# Installation\r\n\r\nDownload and install [Virtualbox](https://www.virtualbox.org/wiki/Downloads)\r\n\r\n\r\nDownload and install [Vagrant](https://www.vagrantup.com/downloads.html)\r\n\r\nMake sure you are at least at Vagrant version 1.5 or the steps below may not work for you.\r\n\r\nThen from a terminal, do:\r\n\r\n```bash\r\n$ vagrant box add rasmus/php7dev\r\n...\r\n$ vagrant init rasmus/php7dev\r\n...\r\n$ vagrant up\r\n...\r\n(You can ignore the warning about the guest additions version)\r\n...\r\n$ vagrant ssh\r\n```\r\n###\r\n \r\nIf everything went well you should now be ssh'ed into your php7dev\r\nenvironment. \r\n\r\nHowever, if you check **/sbin/ifconfig** you will see that your network interface is a private NAT'ed ip. You can get out from it, but you can't get in. Log back out and edit your *~/Vagrantfile*.\r\nMost of it is commented out. Find the section that says **config.vm.network** and add:\r\n\r\n```\r\nconfig.vm.hostname = \"php7dev\"\r\nconfig.vm.network \"public_network\", type: \"dhcp\"\r\n```\r\n\r\nThere are also various vagrant plugins that can help you update your dns. See [local-domain-resolution](https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins#local-domain-resolution). \r\n\r\nThe [landrush](https://github.com/phinze/landrush) one looks interesting since it could be used to create a local **php7dev** domain and you could then just make all your vhosts **myvhost.php7dev** and you wouldn't need to edit your */etc/hosts* file every time you added a new vhost.\r\n\r\n```\r\n$ vagrant reload\r\n```\r\n\r\nIt will ask you which interface to bridge to. Select your current active network interface and it should just work. If you have configured one of the domain resolution plugins you should be set to go now, otherwise, **vagrant ssh** in and check the ip manually and add it to your */etc/hosts* file. Then try it from your browser: \r\n\r\n```\r\nhttp://php7dev/\r\n```\r\n\r\nIt should show the PHP7 phpinfo() page.\r\n \r\nThis also means you don't need to use **vagrant ssh** anymore. You can just ssh directly into the machine like any other machine on your network at this point.\r\n\r\n## Installing phpBB\r\n \r\nNow you can install something. The sites live in */var/www*.\r\n \r\nFor example, to install phpBB:\r\n \r\n```bash\r\n$ cd /var/www\r\n$ wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip\r\n...\r\n$ unzip phpBB-3.1.2.zip\r\n...\r\n$ sudo chown -R www-data phpBB3\r\n```\r\n \r\nNow create */etc/nginx/conf.d/phpbb.conf* with this config:\r\n \r\n```nginx\r\nserver {\r\n listen 80;\r\n server_name phpbb;\r\n root /var/www/phpBB3;\r\n index index.php index.html index.htm;\r\n access_log /var/log/nginx/phpbb-access.log;\r\n error_log /var/log/nginx/phpbb-error.log;\r\n\r\n location ~ /(config\\.php|common\\.php|cache|files|images/avatars/upload|includes|store) {\r\n deny all;\r\n return 403;\r\n }\r\n\r\n location ~* \\.(gif|jpe?g|png|css)$ {\r\n expires 30d;\r\n }\r\n\r\n include php.conf;\r\n}\r\n```\r\n \r\n\r\nYou will need to sudo to do it. It shouldn't ask you for a password,\r\nbut every password, sudo, root, mysql is set to: **vagrant**\r\nin case you need it.\r\n \r\nThen do:\r\n \r\n```bash\r\n$ sudo service nginx reload\r\n```\r\n\r\n\r\nOn the machine you are running your web browser, add an entry to your */etc/hosts* file with:\r\n\r\n```\r\n192.168.x.x phpbb\r\n```\r\n \r\n\r\nSubstitute your ip there, of course.\r\n \r\nNow you can go to **http://phpbb/** and you should be redirected to the phpBB installer.\r\n\r\nBefore you start, you need to create the database:\r\n\r\n```bash\r\n$ mysqladmin create phpbb\r\n```\r\n \r\n\r\nNow go through the steps. Your Database host is **localhost** and the user is **vagrant**, password **vagrant**. Database name is **phpbb**. You can leave the port empty. Click through the rest and you should be done. Then remove the install directory to get rid of the annoying warning:\r\n \r\n```bash\r\n$ sudo rm -rf /var/www/phpBB3/install/\r\n```\r\n\r\n# Installing other apps \r\n \r\nFor the most part installing almost anything follows the same pattern. Download the tarball or zip file to */var/www*. Extract, make it owned by **www-data** and find the nginx server config. Usually a quick Google search will turn it up. If it doesn't, something like:\r\n \r\n```nginx\r\n server {\r\n listen 80;\r\n server_name mysite;\r\n root /var/www/mysite;\r\n access_log /var/log/nginx/mysite-access.log;\r\n error_log /var/log/nginx/mysite-error.log;\r\n\r\n index index.php index.html;\r\n\r\n location / {\r\n try_files $uri $uri/ @rewrite;\r\n }\r\n location @rewrite {\r\n rewrite ^(.*)$ /index.php;\r\n }\r\n\r\n include php.conf;\r\n }\r\n```\r\n \r\n \r\nUsually does the trick. \r\n\r\n## Composer and switching PHP versions\r\n\r\nComposer is installed (in */usr/local/bin*) for the packages that need it. You also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with PHP 7 running, but to switch to 5.6 temporarily:\r\n \r\n```bash\r\n$ sudo service php-fpm stop\r\n$ sudo service php56-fpm start\r\n```\r\n \r\nSimilarly, from the command line you can run **php56**.\r\n \r\n# Debugging Tools\r\n\r\nFor debugging, you have many options. Valgrind is installed and the suppressions file is up to date. I have included a helper script I use called memcheck. Try it:\r\n \r\n```bash\r\n$ memcheck php -v\r\n==3788== Memcheck, a memory error detector\r\n==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\r\n==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\r\n==3788== Command: php -v\r\n==3788==\r\nPHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)\r\nCopyright (c) 1997-2015 The PHP Group\r\nZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies\r\n with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies\r\n==3788==\r\n==3788== HEAP SUMMARY:\r\n==3788== in use at exit: 19,112 bytes in 17 blocks\r\n==3788== total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated\r\n==3788==\r\n==3788== LEAK SUMMARY:\r\n==3788== definitely lost: 0 bytes in 0 blocks\r\n==3788== indirectly lost: 0 bytes in 0 blocks\r\n==3788== possibly lost: 0 bytes in 0 blocks\r\n==3788== still reachable: 0 bytes in 0 blocks\r\n==3788== suppressed: 19,112 bytes in 17 blocks\r\n==3788==\r\n==3788== For counts of detected and suppressed errors, rerun with: -v\r\n==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)\r\n```\r\n \r\n \r\nAlso, sometimes it is easier to track down issues with a single standalone process instead of using php-fpm. You can do this like this:\r\n \r\n```bash\r\n$ sudo service php-fpm stop\r\n$ sudo php-cgi -b /var/run/php-fpm.sock\r\n```\r\n\r\n \r\nThe debug build will report memory leaks and you can of course run it\r\nunder gdb or valgrind as well. See the */usr/local/bin/memcheck* script\r\nfor how to run Valgrind.\r\n \r\nTo update php7 to the latest, do this:\r\n \r\n```bash\r\n$ cd php-src\r\n$ git pull -r\r\n$ make distclean\r\n$ ./buildconf -f\r\n$ ./cn\r\n$ make\r\n$ sudo make install\r\n$ sudo service php-fpm restart\r\n``` \r\n\r\n\r\nIt should be quite fast because ccache is installed and the cache should be relatively recent.\r\n\r\nYou will also find a .gdbinit symlink in *~vagrant* which provides a number of useful gdb macros. The symlink into php-src should ensure you have the right set for the current checked out version of the code.\r\n\r\n# APT \r\n\r\nAnd a tiny apt primer:\r\n* update pkg list: **sudo apt-get update**\r\n* search for stuff: **apt-cache search stuff**\r\n* install stuff: **sudo apt-get install stuff**\r\n* list installed: **dpkg -l**\r\n* upgrade installed: **apt-get upgrade**\r\n \r\nIf something isn't working or you have suggestions, please let me know.","providers":[{"name":"virtualbox","checksum":null,"checksum_type":null,"url":"https://vagrantcloud.com/rasmus/boxes/php7dev/versions/0.0.2/providers/virtualbox/unknown/vagrant.box"}]},{"version":"0.0.1","status":"active","description_html":"Download and install Virtualbox
\n\nDownload and install Vagrant
\n\nThen from a terminal, do:
\n\n$ vagrant box add rasmus/php7dev\n...\n$ vagrant init rasmus/php7dev\n...\n$ vagrant up\n...\n(You can ignore the warning about the guest additions version)\n...\n$ vagrant ssh\n
\n\nIf everything went well you should now be ssh'ed into your php7dev\nenvironment.
\n\nHowever, if you check /sbin/ifconfig you will see that your network interface is a private NAT'ed ip. You can get out from it, but you can't get in. Log back out and edit your ~/Vagrantfile.\nMost of it is commented out. Find the section that says config.vm.network and add:
\n\nconfig.vm.network "public_network", type: "dhcp"\n
\n\nThere is also a hostmanager plugin that can help here. Do this:
\n\n$ vagrant plugin install vagrant-hostmanager\n
\n\nAnd these lines to your ~/Vagrantfile:
\n\n config.hostmanager.enabled = true\n config.hostmanager.manage_host = true\n config.hostmanager.include_offline = true\n config.hostmanager.ignore_private_ip = false\n
\n\nThen do:
\n\n$ vagrant reload\n
\n\nIt will ask you which interface to bridge to. Select your current active network interface and it should just work. Try it from your browser: http://php7dev/
It should show the PHP7 phpinfo() page.
\n\nOtherwise, if the host manager didn't do its thing, vagrant ssh
back in and check the ip manually and add it to your /etc/hosts file.
This also means you don't need to use vagrant ssh anymore. You can just ssh directly into the machine like any other machine on your network at this point.
\n\nNow you can install something. The sites live in /var/www.
\n\nFor example, to install phpBB:
\n\n$ cd /var/www\n$ wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip\n...\n$ unzip phpBB-3.1.2.zip\n...\n$ sudo chown -R www-data phpBB3\n
\n\nNow create /etc/nginx/conf.d/phpbb.conf with this config:
\n\nserver {\n listen 80;\n server_name phpbb;\n root /var/www/phpBB3;\n index index.php index.html index.htm;\n access_log /var/log/nginx/phpbb-access.log;\n error_log /var/log/nginx/phpbb-error.log;\n\n location ~ /(config\\.php|common\\.php|cache|files|images/avatars/upload|includes|store) {\n deny all;\n return 403;\n }\n\n location ~* \\.(gif|jpe?g|png|css)$ {\n expires 30d;\n }\n\n include php.conf;\n}\n
\n\nYou will need to sudo to do it. It shouldn't ask you for a password,\nbut every password, sudo, root, mysql is set to: vagrant\nin case you need it.
\n\nThen do:
\n\n$ sudo service nginx reload\n
\n\nOn the machine you are running your web browser, add an entry to your /etc/hosts file with:
\n\n192.168.x.x phpbb\n
\n\nSubstitute your ip there, of course.
\n\nNow you can go to http://phpbb/ and you should be redirected to the phpBB installer.
\n\nBefore you start, you need to create the database:
\n\n$ mysqladmin create phpbb\n
\n\nNow go through the steps. Your Database host is localhost and the user is vagrant, password vagrant. Database name is phpbb. You can leave the port empty. Click through the rest and you should be done. Then remove the install directory to get rid of the annoying warning:
\n\n$ sudo rm -rf /var/www/phpBB3/install/\n
\n\nFor the most part installing almost anything follows the same pattern. Download the tarball or zip file to /var/www. Extract, make it owned by www-data and find the nginx server config. Usually a quick Google search will turn it up. If it doesn't, something like:
\n\n server {\n listen 80;\n server_name mysite;\n root /var/www/mysite;\n access_log /var/log/nginx/mysite-access.log;\n error_log /var/log/nginx/mysite-error.log;\n\n index index.php index.html;\n\n location / {\n try_files $uri $uri/ @rewrite;\n }\n location @rewrite {\n rewrite ^(.*)$ /index.php;\n }\n\n include php.conf;\n }\n
\n\nUsually does the trick.
\n\nComposer is installed (in /usr/local/bin) for the packages that need it. You also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with PHP 7 running, but to switch to 5.6 temporarily:
\n\n$ sudo service php-fpm stop\n$ sudo service php56-fpm start\n
\n\nSimilarly, from the command line you can run php56.
\n\nFor debugging, you have many options. Valgrind is installed and the suppressions file is up to date. I have included a helper script I use called memcheck. Try it:
\n\n$ memcheck php -v\n==3788== Memcheck, a memory error detector\n==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\n==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\n==3788== Command: php -v\n==3788==\nPHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)\nCopyright (c) 1997-2015 The PHP Group\nZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies\n with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies\n==3788==\n==3788== HEAP SUMMARY:\n==3788== in use at exit: 19,112 bytes in 17 blocks\n==3788== total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated\n==3788==\n==3788== LEAK SUMMARY:\n==3788== definitely lost: 0 bytes in 0 blocks\n==3788== indirectly lost: 0 bytes in 0 blocks\n==3788== possibly lost: 0 bytes in 0 blocks\n==3788== still reachable: 0 bytes in 0 blocks\n==3788== suppressed: 19,112 bytes in 17 blocks\n==3788==\n==3788== For counts of detected and suppressed errors, rerun with: -v\n==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)\n
\n\nAlso, sometimes it is easier to track down issues with a single standalone process instead of using php-fpm. You can do this like this:
\n\n$ sudo service php-fpm stop\n$ sudo php-cgi -b /var/run/php-fpm.sock\n
\n\nThe debug build will report memory leaks and you can of course run it\nunder gdb or valgrind as well. See the /usr/local/bin/memcheck script\nfor how to run Valgrind.
\n\nTo update php7 to the latest, do this:
\n\n$ cd php-src\n$ git pull -r\n$ make distclean\n$ ./buildconf -f\n$ ./cn\n$ make\n$ sudo make install\n$ sudo service php-fpm restart\n
\n\nAnd a tiny apt primer:
\n\nIf something isn't working or you have suggestions, please let me know.
\n","description_markdown":"Download and install [Virtualbox](https://www.virtualbox.org/wiki/Downloads)\r\n\r\n\r\nDownload and install [Vagrant](https://www.vagrantup.com/downloads.html)\r\n\r\nThen from a terminal, do:\r\n\r\n```bash\r\n$ vagrant box add rasmus/php7dev\r\n...\r\n$ vagrant init rasmus/php7dev\r\n...\r\n$ vagrant up\r\n...\r\n(You can ignore the warning about the guest additions version)\r\n...\r\n$ vagrant ssh\r\n```\r\n \r\nIf everything went well you should now be ssh'ed into your php7dev\r\nenvironment. \r\n\r\nHowever, if you check **/sbin/ifconfig** you will see that your network interface is a private NAT'ed ip. You can get out from it, but you can't get in. Log back out and edit your *~/Vagrantfile*.\r\nMost of it is commented out. Find the section that says **config.vm.network** and add:\r\n\r\n```\r\nconfig.vm.network \"public_network\", type: \"dhcp\"\r\n```\r\n\r\nThere is also a hostmanager plugin that can help here. Do this:\r\n\r\n```\r\n$ vagrant plugin install vagrant-hostmanager\r\n```\r\nAnd these lines to your *~/Vagrantfile*:\r\n\r\n```\r\n config.hostmanager.enabled = true\r\n config.hostmanager.manage_host = true\r\n config.hostmanager.include_offline = true\r\n config.hostmanager.ignore_private_ip = false\r\n```\r\n\r\nThen do:\r\n\r\n```\r\n$ vagrant reload\r\n```\r\n \r\nIt will ask you which interface to bridge to. Select your current active network interface and it should just work. Try it from your browser: `http://php7dev/`\r\n\r\nIt should show the PHP7 phpinfo() page.\r\n\r\nOtherwise, if the host manager didn't do its thing, `vagrant ssh` back in and check the ip manually and add it to your */etc/hosts* file. \r\n \r\nThis also means you don't need to use **vagrant ssh** anymore. You can just ssh directly into the machine like any other machine on your network at this point.\r\n \r\nNow you can install something. The sites live in */var/www*.\r\n \r\nFor example, to install phpBB:\r\n \r\n```bash\r\n$ cd /var/www\r\n$ wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip\r\n...\r\n$ unzip phpBB-3.1.2.zip\r\n...\r\n$ sudo chown -R www-data phpBB3\r\n```\r\n \r\nNow create */etc/nginx/conf.d/phpbb.conf* with this config:\r\n \r\n```nginx\r\nserver {\r\n listen 80;\r\n server_name phpbb;\r\n root /var/www/phpBB3;\r\n index index.php index.html index.htm;\r\n access_log /var/log/nginx/phpbb-access.log;\r\n error_log /var/log/nginx/phpbb-error.log;\r\n\r\n location ~ /(config\\.php|common\\.php|cache|files|images/avatars/upload|includes|store) {\r\n deny all;\r\n return 403;\r\n }\r\n\r\n location ~* \\.(gif|jpe?g|png|css)$ {\r\n expires 30d;\r\n }\r\n\r\n include php.conf;\r\n}\r\n```\r\n \r\nYou will need to sudo to do it. It shouldn't ask you for a password,\r\nbut every password, sudo, root, mysql is set to: **vagrant**\r\nin case you need it.\r\n \r\nThen do:\r\n \r\n```bash\r\n$ sudo service nginx reload\r\n```\r\n \r\nOn the machine you are running your web browser, add an entry to your */etc/hosts* file with:\r\n\r\n```\r\n192.168.x.x phpbb\r\n```\r\n \r\nSubstitute your ip there, of course.\r\n \r\n \r\nNow you can go to **http://phpbb/** and you should be redirected to the phpBB installer.\r\n\r\nBefore you start, you need to create the database:\r\n\r\n```bash\r\n$ mysqladmin create phpbb\r\n```\r\n \r\nNow go through the steps. Your Database host is **localhost** and the user is **vagrant**, password **vagrant**. Database name is **phpbb**. You can leave the port empty. Click through the rest and you should be done. Then remove the install directory to get rid of the annoying warning:\r\n \r\n```bash\r\n$ sudo rm -rf /var/www/phpBB3/install/\r\n```\r\n \r\n \r\nFor the most part installing almost anything follows the same pattern. Download the tarball or zip file to */var/www*. Extract, make it owned by **www-data** and find the nginx server config. Usually a quick Google search will turn it up. If it doesn't, something like:\r\n \r\n```nginx\r\n server {\r\n listen 80;\r\n server_name mysite;\r\n root /var/www/mysite;\r\n access_log /var/log/nginx/mysite-access.log;\r\n error_log /var/log/nginx/mysite-error.log;\r\n\r\n index index.php index.html;\r\n\r\n location / {\r\n try_files $uri $uri/ @rewrite;\r\n }\r\n location @rewrite {\r\n rewrite ^(.*)$ /index.php;\r\n }\r\n\r\n include php.conf;\r\n }\r\n```\r\n \r\nUsually does the trick.\r\n \r\n \r\nComposer is installed (in */usr/local/bin*) for the packages that need it. You also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with PHP 7 running, but to switch to 5.6 temporarily:\r\n \r\n```bash\r\n$ sudo service php-fpm stop\r\n$ sudo service php56-fpm start\r\n```\r\n \r\nSimilarly, from the command line you can run **php56**.\r\n \r\n \r\nFor debugging, you have many options. Valgrind is installed and the suppressions file is up to date. I have included a helper script I use called memcheck. Try it:\r\n \r\n```bash\r\n$ memcheck php -v\r\n==3788== Memcheck, a memory error detector\r\n==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\r\n==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\r\n==3788== Command: php -v\r\n==3788==\r\nPHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)\r\nCopyright (c) 1997-2015 The PHP Group\r\nZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies\r\n with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies\r\n==3788==\r\n==3788== HEAP SUMMARY:\r\n==3788== in use at exit: 19,112 bytes in 17 blocks\r\n==3788== total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated\r\n==3788==\r\n==3788== LEAK SUMMARY:\r\n==3788== definitely lost: 0 bytes in 0 blocks\r\n==3788== indirectly lost: 0 bytes in 0 blocks\r\n==3788== possibly lost: 0 bytes in 0 blocks\r\n==3788== still reachable: 0 bytes in 0 blocks\r\n==3788== suppressed: 19,112 bytes in 17 blocks\r\n==3788==\r\n==3788== For counts of detected and suppressed errors, rerun with: -v\r\n==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)\r\n```\r\n \r\n \r\nAlso, sometimes it is easier to track down issues with a single standalone process instead of using php-fpm. You can do this like this:\r\n \r\n```bash\r\n$ sudo service php-fpm stop\r\n$ sudo php-cgi -b /var/run/php-fpm.sock\r\n```\r\n \r\nThe debug build will report memory leaks and you can of course run it\r\nunder gdb or valgrind as well. See the */usr/local/bin/memcheck* script\r\nfor how to run Valgrind.\r\n \r\nTo update php7 to the latest, do this:\r\n \r\n```bash\r\n$ cd php-src\r\n$ git pull -r\r\n$ make distclean\r\n$ ./buildconf -f\r\n$ ./cn\r\n$ make\r\n$ sudo make install\r\n$ sudo service php-fpm restart\r\n``` \r\n \r\n \r\nAnd a tiny apt primer:\r\n* update pkg list: **sudo apt-get update**\r\n* search for stuff: **apt-cache search stuff**\r\n* install stuff: **sudo apt-get install stuff**\r\n* list installed: **dpkg -l**\r\n* upgrade installed: **apt-get upgrade**\r\n \r\nIf something isn't working or you have suggestions, please let me know.","providers":[{"name":"virtualbox","checksum":null,"checksum_type":null,"url":"https://vagrantcloud.com/rasmus/boxes/php7dev/versions/0.0.1/providers/virtualbox/unknown/vagrant.box"}]}]}