Brew Xdebug
Xdebug: A powerful debugger for PHP. This setting controls which Xdebug features are enabled. This setting can only be set in php.ini or files like 99-xdebug.ini that are read when a PHP process starts (directly, or through php-fpm), but not in.htaccess and.user.ini files, which are read per-request. Since Brew is no longer working, you can use pecl to install the debugger. It's not as good as brew, you may run into dependency problems but it works. Install php with brew, whatever version you want, then use pecl. Brew install php pecl install xdebug. Xdebug documentation: If enabled, the xdebug.remotehost setting is ignored and Xdebug will try to connect to the client that made the HTTP request. It checks the $SERVER‘HTTPXFORWARDEDFOR’ and $SERVER‘REMOTEADDR’ variables to find out which IP address to use. Brew doctor will complain if this isn’t the case. Add PHP Packages to Homebrew. PHP packages of OSX are not available to homebrew by default. Brew install php53-xdebug The notes from the installation mention the location of the Xdebug config file.
Read this in other languages: English, Português - BR, 日本語.
phpbrew builds and installs multiple version php(s) in your $HOME directory.
What phpbrew can do for you:
- Configure options are simplified into variants, no worries about the path anymore!
- Build php with different variants like PDO, mysql, sqlite, debug ..etc.
- Compile apache php module and separate them by different versions.
- Build and install php(s) in your home directory, so you don't need root permission.
- Switch versions very easily and is integrated with bash/zsh shell.
- Automatic feature detection.
- Install & enable php extensions into current environment with ease.
- Install multiple php into system-wide environment.
- Path detection optimization for HomeBrew and MacPorts.
Requirement
Please see Requirementbefore you get started. you need to install some development packages forbuilding PHP.
Installation
Just download it:
Then you can install it into your bin folder:
Be sure to have /usr/local/bin
in your $PATH
environment variable.
Setting up
Init a bash script for your shell environment:
Add these lines to your .bashrc
or .zshrc
file:
Setting up lookup prefix
You may setup your prefered default prefix for looking up libraries, availableoptions are macports
, homebrew
, debian
, ubuntu
or a custom path:
For Homebrew users:
Burn for mac free download. For Macports users:
Basic usage
To list known versions:
To show more minor versions:
To update the release info:
To get older versions (less than 5.4)
Please note that we don't guarantee that you can build the php versions thatare not supported by offical successfully, please don't fire any issue aboutthe older versions, these issues won't be fixed.
To list known older versions (less than 5.4)
Starting Building Your Own PHP
Simply build and install PHP with default variant:
Here we suggest default
variant set, which includes most commonly usedvariants, if you need a minimum install, just remove the default
variant set.
You can enable parallel compilation by passing -j
or --jobs
option andthe following is an example:
With tests:
With debug messages:
To install older versions (less than 5.3):
To install the next (unstable) version:
To install from a github tag:
Cleaning up build directory
Variants
PHPBrew arranges configure options for you, you can simply specify variantname, and phpbrew will detect include paths and build options for configuring.
PHPBrew provides default variants and some virtual variants,to the default variants, which includes the most commonly used variants,to the virtual variants, which defines a variant set, you may use one virtual variantto enable multiple variants at one time.
To check out what is included in these variants, simply run variants
subcommand to list these variants:
To enable one variant, simply add a prefix +
before the variant name, eg
To disable one variant, simply add a prefix -
before the variant name.
For example, if we want to build PHP with the default options anddatabase supports (mysql, sqlite, postgresql), you may simply run:
You may also build PHP with extra variants:
To build PHP with pgsql (PostgreSQL) extension:
Or build pgsql extension with postgresql base dir on Mac OS X:
The pgsql path is the location of pg_config
, you could find pg_config
in the /opt/local/lib/postgresql91/bin
To build PHP with neutral compile options, you can specify neutral
virtual variant, which means that phpbrewdoesn't add any additional compile options including --disable-all
. But some options(for example --enable-libxml
)are still automatically added to support pear
installation.You can build PHP with neutral
:
For more details, please check out PHPBrew Cookbook.
Extra Configure Options
To pass extra configure arguments, you can do this:
Use And Switch
Use (switch version temporarily):
Switch PHP version (switch default version)
Turn Off:
If you enable apache PHP modules, remember to comment out or remove the settings.
List installed PHP
The Extension Installer
You can also install PHP extension with ease, either the extensions shippedwith PHP source code or even from PECL.
If the extension directory is found in PHP source, PHPBrew automatically switch intothe PHP source directory and install the extension.
If the extension directory is not found in PHP source, PHPBrew fetch the extensionpackage from PECL http://pecl.php.net.
PHPBrew also creates extension config to enable the installed extension, so youdon't need to write the config file to enable it by hands. The extension configdirectory is in:
Installing Extension - The Most Simple Way
Before you install any PHP extension, you should set your current running php:
Then run ext install
to install the extensions
Installing Extension With Stability
To install extensions with stability tag:
To install extensions with version name:
Showing extension config options
To see if there are some configure options to build the extension, you can usethe ext show
command. Please note that the show
command only works forbuilt-in extensions:
Install extensions with customized options:
Installing Extension from GitHub
The special prefix github:
tells phpbrew to get the extension repository fromphp-memcached-dev/phpmemcached
and branch php7
Installing Extension with specific downloader
Right now, phpbrew supports 4 different downloader implementation:
php_curl
- download files using the built-in php curl extension.php_stream
- download files using the built-in php stream wrapper.curl
wget
It's possible to replace the default downloader with your preference:
The curl php extension based downloader supports User-Agent and Proxy Settings,thus you can do this if you encountered some network issues:
Enabling Extension
You can also install extension via PECL and enable it manually:
The ext enable
command allows you to create a config {current php base}/var/db/{extension name}.inito enable the extension.
Configuring the php.ini for current php version
Simply run:
You may specify the EDITOR environment variable to your favorite editor:
Upgrade phpbrew
To upgrade phpbrew, you may simply run the self-update
command,this command enables you to install the latest version ofmaster
branch from GitHub:
The Installed PHP(s)
The installed phps are located in ~/.phpbrew/php
, for example, php 5.4.20 is located at:
And you should put your configuration file in:
Extension configuration files should be put in:
Quick commands to switch between directories
Switching to PHP build directory
Switching to PHP dist directory
Switching to PHP etc directory
Switching to PHP var directory
PHP FPM
phpbrew also provides useful fpm managing sub-commands. to use them, pleaseremember to enable +fpm
variant when building your own php.
To start php-fpm, simply type:
To stop php-fpm, type:
To show php-fpm modules:
To test php-fpm config: Best macbook to buy 2016.
To edit php-fpm config:
Brew Xdebug Php 7.4
The installed php-fpm
is located in ~/.phpbrew/php/php-*/sbin
.
The correspond php-fpm.conf
is lcoated in ~/.phpbrew/php/php-*/etc/php-fpm.conf.default
,you may copy the default config file to the desired location. e.g.,
Enabling Version Info Prompt
To add PHP version info in your shell prompt, you can use'PHPBREW_SET_PROMPT=1'
variable.
The default is 'PHPBREW_SET_PROMPT=0'
(disable). To enable it, you can add thisline to your ~/.bashrc
file and put this line before you source~/.phpbrew/bashrc
.
To embed version info in your prompt, you can usephpbrew_current_php_version
shell function, which is defined in .phpbrew/bashrc
.and you can set the version info in your PS1
var.e.g.
Known Issues
Brew Xdebug Vs
For PHP-5.3+ versions, 'Building intl 64-bit fails on OS X' https://bugs.php.net/bug.php?id=48795
To build PHP with GD extension, you need to specify your libpng dir and libjpeg dir, for example,
$ phpbrew install php-5.4.10 +default +mysql +intl +gettext +apxs2=/usr/bin/apxs2 -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-natf --with-jpeg-dir=/usr --with-png-dir=/usr
Troubleshooting
Please see TroubleShooting
FAQ
Q: How do I have the same version with different compile option?
A: Currently, you can install php5.x.x and rename the /Users/phpbrew/.phpbrew/php/php-5.x.x folder to the new name, for example, php-5.x.x-super , and install another php-5.3.3
Contribution
Please see Contribution
Documentation
Brew Install Xdebug Php 7.4
Please see Wiki
Author
Brew Xdebug Pro
- Yo-An Lin (c9s)
- Márcio Almad
Brew Xdebug 2020
License
See LICENSE file.