Search

Settings > Languages > PHP

PHP is a popular web scripting programming language. MAMP PRO installs several versions of the PHP script interpreter.

MAMP PRO - Settings - Languages - PHP


  • Default version
    When creating a new site its PHP version will be set to the selected 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.

      MAMP PRO - Settings - Languages - PHP - Add additional PHP version

      Adding Additional PHP Versions

    • Minus
      A click on this button will delete the selected PHP version from your development environment. You have to confirm this before.

      MAMP PRO - Settings - Languages - PHP - Remove PHP version

      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
      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 php-config='/Applications/MAMP/bin/php/phpx.x.x/bin/php-config'
      alias phpdbg='/Applications/MAMP/bin/php/phpx.x.x/bin/phpdbg'
      alias phpize='/Applications/MAMP/bin/php/phpx.x.x/bin/phpize'
      alias pear='/Applications/MAMP/bin/php/phpx.x.x/bin/pear'
      alias peardev='/Applications/MAMP/bin/php/phpx.x.x/bin/peardev'
      alias pecl='/Applications/MAMP/bin/php/phpx.x.x/bin/pecl'
      

      Confirm your PHP is enabled by typing php -v in a new Terminal window.

      MAMP PRO - Settings - Languages - PHP - Command line

      Note: MAMP PRO also adds the path to the bin folder of the currently selected PHP version to the $PATH variable in your ~/.profile file. As this file will be sourced by the shells bash and zsh do not make changes to $PATH in other config files of these shells.

      export PATH="/Applications/MAMP/bin/php/phpx.x.x/bin"
      
      • 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'
        

  • Cache module:
    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.

    • 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.

    • 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.


  • Log:
    Here you define the type of messages to be reported and where the messages should be written to.

    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 options E_ERROR, E_WARNING and E_NOTICE (see “Predefined Constants”).

    • Initialization errors
      Log errors that occur when Apache loads the PHP module.

    • All messages (E_ALL)
      If you activate this checkbox, all messages are reported. This option corresponds to the setting E_ALL.

    • Errors (E_ERROR)
      If you activate this checkbox, all errors are reported. This option corresponds to the setting E_ERROR.

    • Warnings (E_WARNING)
      If you activate this checkbox, all warnings are reported. This option corresponds to the setting E_WARNING.

    • Notices (E_NOTICE)
      If you activate this checkbox, all notices are reported. This option corresponds to the setting E_NOTICE.

    • Other
      Report further error types through constants.

    • 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 PRO/logs/php_error.log”.

Additional Information