Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Forked from nrackleff/drupal-56-upgrade
Last active April 13, 2018 20:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Greg-Boggs/f0774f491eed9973e303 to your computer and use it in GitHub Desktop.
Save Greg-Boggs/f0774f491eed9973e303 to your computer and use it in GitHub Desktop.
Install Php56 with Drupal configs on Mac with Homebrew with xedebug and OPcache
Steps to update local dev environment to PHP5.6 to be ready for Drupal 8.
In a terminal window:
brew update ( you may also may need brew doctor)
brew unlink php55
brew install php56 --with-homebrew-apxs --with-apache
brew install php56-xdebug
brew install php56-apcu
brew install php56-opcache
Configure apache to use the new version of php:
Open /usr/local/etc/apache2/2.2/http.conf and search for php5 and update the Loadmodule line to the new version you just installed.
Check your php56 path to be sure. In my case, I changed:
LoadModule php5_module /usr/local/Cellar/php55/5.5.26/libexec/apache2/libphp5.so
to:
LoadModule php5_module /usr/local/Cellar/php56/5.6.11_2/libexec/apache2/libphp5.so
(At Greg's suggestion, I actually commented out the first line and added the second one so I could easily switch if desired.)
Make some modifications to your new php.ini file:
Open /usr/local/etc/php/5.6/php.ini
We did a diff between the php55 version and the php56 version and changed the following (uncomment any of these in addition to changing them if needed):
max_execution_time = 300
max_input_vars = 2000
memory_limit = 256M
max_input_time = 600
post_max_size = 200M
upload_max_filesize = 100M
default_socket_timeout = 600
Uncomment opcache.enable and set it to 1
opcache.enable=1
opcache.memory_consumption=256
xdebug info for phpstorm
Open /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini it should contain something like:
[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
Add the following lines:
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
; Needed for Drupal 8
xdebug.max_nesting_level = 250
That should be everything. Now restart apache and check to make sure everything is working.
apachectl restart
Once apache has restarted, created a new php file at the root of one of you web sites. I called mine info.php. It should contain the following:
<?php
phpinfo();
?>
Browse to that file in your web browser and:
Search for xdebug. It should appear many times. In my case it was 62 times. If it only appears once, it probably means it is not enabled.
Search for opcache. It should also appear more than once. In my case it was 31 times.
Navigate to one of your existing local Drupal sites and clear the cache through the admin interface at /admin/config/development/performance and make sure it doesn’t take an unreasonable amount of time. Should be a few seconds vs. minutes if everything is okay. Navigate around the rest of your dev site and make sure all is well.
You are now ready for Drupal 8! Yay!
@cviebrock
Copy link

brew install php56-xdebug no longer works since php got moved into brew's core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment