Languages > PHP
PHP is a popular web scripting programming language. MAMP PRO installs several versions of the PHP script interpreter.
-
Default version
Select which PHP version will be the default version.-
Plus
A click on this button opens a dialog box with a list of the additional available PHP versions. By clicking on the “Install” button of the required PHP version this version will be added to your development environment. Afterwards a restart of MAMP PRO is necessary. -
Minus
A click on this button will delete the selected PHP version from your development environment. You have to confirm this before.MAMP PRO requires PHP 5.4.45 internally for the installation of the extras. This version can therefore not be removed and the minus button is deactivated for this PHP version.
-
Open template…
A click on this button opens the internally used template file for the php.ini file in an editor window. More information about this template file can be found here. -
Activate command line shortcuts for the selected PHP version, pear & pecl
Check this option to make the current PHP version available on the command line. This allows you to install additional PHP extensions via PECL, for example. MAMP PRO uses aliases to provide this functionality. When this option is checked the following is added to your “~/.profile” file.alias php='/Applications/MAMP/bin/php/phpx.x.x/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/phpx.x.x.ini"' alias pear='/Applications/MAMP/bin/php/phpx.x.x/bin/pear' alias pecl='/Applications/MAMP/bin/php/phpx.x.x/bin/pecl'
After the default PHP version is changed when this option has been selected, this command should be run in a new Terminal window to refresh the settings to reflect the changes:
source ~/.profile
Confirm your PHP is enabled by typing
php -v
in a new Terminal window.Note: MAMP PRO also adds the path to thebin
folder of the currently selected PHP version to the$PATH
variable in your~/.profile
file. As this file will be sourced by the shellsbash
andzsh
do not make changes to$PATH
in other config files of these shells.-
Also activate shortcut for Composer
When this option is checked the following is added to your “~/.profile” file.alias composer='/Applications/MAMP/bin/php/composer'
-
-
-
Mode
Choose whether to use identical PHP versions for all hosts (Module) or on a host by host basis (CGI).-
Module (all hosts use the same PHP version)
Select this option to run PHP in module mode. All your hosts will use the same version of PHP. -
CGI (every host may be set to a different PHP version)
Select this option to run PHP in CGI mode. This allows you to specify which version of PHP to use for each of your hosts separately.More information on how to change the PHP version for an individual host is covered in the Settings > Hosts > General section.
-
-
Cache module to speed up execution
PHP has several cache extensions that can help speed up execution in certain circumstances. This is set to “off” by default. Enabling a cache extension does not necessarily translate into greater execution speed. A particular cache is not available for the current PHP version if it is not enabled.Several caches provide a user interface to help analyze and profile your code. Press the arrow button to the right of the cache name to view this interface. An interface is not available if the arrow button is not enabled.
-
off
Select this option if no PHP cache module should be used. -
APC
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. You can learn more about APC here. -
eAccelerator
eAccelerator a free open-source PHP accelerator & optimizer. This cache is available for the following PHP versions: 5.3 & 5.4. You can learn more about eAccelerator here. -
XCache
XCache is a open-source opcode cacher. This cache is available for the following PHP versions: 5.3 to 5.6. You can learn more about XCache here. -
OPCache
OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. You can learn more about OPcache here.
-
-
Extensions
-
Xdebug (Debugger)
Activate Xdebug to allow PHP to create debugging information during script execution. By default, Xdebug uses localhost and port 9000 in the php.ini file. More information on using Xdebug with the MacGDBp Debugger can be founder here.-
Download MacGDBp…
Clicking this button opens the MacGDBp website in your default browser. -
Open MacGDBp
With Xdebug activated you can open the MacGDBp debugger to enable PHP debugging. By default, MacGDBp expects debugging information on port 9000 of localhost. More information on using Xdebug with the MacGDBp Debugger can be founder here.
-
-
Imagick / ImageMagick
If you activate this checkbox, then Imagick resp. ImageMagick is available. -
Tidy
If you activate this checkbox, then Tidy is available. -
Oauth
If you activate this checkbox, then Oauth is available. -
Enable other extensions…
A click on this button opens the internally used template file for the php.ini file in an editor window. More information about this template file can be found here.
-
-
What to log
Here you define the type of messages to be reported.-
Display startup errors
Log errors that occur when Apache loads the PHP module. -
All other errors and warnings (E_ALL)
If you activate this checkbox, all messages are reported. This option corresponds to the settingE_ALL
. -
Errors (E_ERROR)
If you activate this checkbox, all errors are reported. This option corresponds to the settingE_ERROR
. -
Warnings (E_WARNING)
If you activate this checkbox, all warnings are reported. This option corresponds to the settingE_WARNING
. -
Notices (E_NOTICE)
If you activate this checkbox, all notices are reported. This option corresponds to the settingE_NOTICE
. -
Other
Report further error types through constants.
For information about PHP error handling, see the PHP documentation in the “error_reporting” section. Please note: The option
E_ALL
comprises more than the optionsE_ERROR
,E_WARNING
andE_NOTICE
(see “Predefined Constants”. -
-
Log errors
Here you can choose where the messages should be written to.-
to screen
Activate this checkbox if you want the messages to be displayed on your website. -
to file
Activate this checkbox if the messages are to be written to a file.- Choose…
Here you can choose the directory and the file name. By default, the message is written to the file “/Applications/MAMP/logs/php_error.log”.
- Choose…
-