XAMPP and MODX

What is XAMPP?

XAMPP is a free Open-Source package you can install on your local machine. XAMPP provides relatively recent versions of Apache, MySQL, PHP, and the FileZilla mail server. After installing XAMPP, you can run MODX on your local Windows, OS X, or Linux box. You could download the components separately and install them, but XAMPP installs them all with a single click and provides versions that are (theoretically) compatible with each other.

Where Do I Get XAMPP?

XAMPP is available here. For Windows, I recommend downloading the self-extracting .exe version. It should install when you double-click on the downloaded file. It's not a bad idea to keep a couple of previous versions of the downloaded .exe file. Occasionally, there are problems with a new release and you will want to revert.

Configuring XAMPP

Note: These instructions are mainly for installing XAMPP on Windows machines. If you're installing it on another platform, the file locations will probably be different. Also, the current versions of XAMPP no longer support Windows XP.

There's really only one thing you'll want to do and it's only necessary if you want Friendly URLs in MODX. Later, hen you turn FURLs on and MODX crashes, you may not remember that this is the reason. It's simple, so you might as well do it when you install:

  • Edit XAMPP/apache/conf/httpd.conf. Remove the # in front of
        LoadModule rewrite_module modules/mod_rewrite.so

Securing XAMPP

If your machine is not connected to the internet and you are the only person who uses it, you can ignore this section, otherwise:

  • Go to https://localhost/security/xamppsecurity.php to create the MySQL master password and protect the XAMPP directory. For the MySQL Root password section, leave the "current password" field blank and enter the password that is in your MODX config file. You can protect your XAMPP directory with a username and password here also, but notice that there are separate buttons for the different actions.
  • Edit /XAMPP/phpMyAdmin/config.inc.php and change the authorization type in this line:
    $cfg['Servers'][$i]['auth_type'] = 'config';
    to cookie:
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
  • Restart Apache
  • Restart MySQL
  • Go to https://localhost/security to make sure everything is secure. Ignore the warning about PHP not running in "Safe" mode.
  • Upgrading or Downgrading XAMPP

    To upgrade XAMPP, you can usually just install the newer version (sometimes there is a separate "upgrade" version). There's no need to uninstall the current version. If you want to downgrade, however, it's usually wise to uninstall the current version, reboot, and double-click on the older installation file.

    WARNING: If you uninstall XAMPP, you will be asked if you want to uninstall the MySQL database and the HTDOCS directory. JUST SAY NO, unless you want to wipe out your MODX site and its content.

    When you downgrade to an older version of XAMPP after uninstalling, you are likely to have several problems that the following steps will solve. It's possible, but unlikely, that you will encounter these problems in an upgrade to a newer version. The install may change the MySQL username and password used by XAMPP back to their defaults and you may get an Access Denied or Error 500 message when you try to access XAMPP security or MODX. The XAMPP install may mess up the .htaccess file in /xampp/htdocs/xampp. It will also usually turn off the rewrite engine and change the username and password in /xampp/phpMyAdmin/config.inc.php which will make phpMyAdmin impossible to access. The steps below should fix those problems:

    Before upgrading or downgrading, make a note of the username and password in /xampp/phpMyAdmin/config.inc.php in case you need to restore them later.

    After upgrading or downgrading:

    • Delete the .htacces file in /xampp/htdocs/xampp.
    • Go to https://localhost/security/xamppsecurity.php to create the MySQL master password and protect the XAMPP directory. For the MySQL Root password section, leave the "current password" field blank and enter the password that is in your MODX config file. You can protect your XAMPP directory with a username and password here also, but notice that there are separate buttons for the different actions.
    • Edit /XAMPP/phpMyAdmin/config.inc.php and change the authorization type in this line:
      $cfg['Servers'][$i]['auth_type'] = 'config';
      to cookie:
      $cfg['Servers'][$i]['auth_type'] = 'cookie';
    • Edit XAMPP/apache/conf/httpd.conf. Remove the # in front of
          LoadModule rewrite_module modules/mod_rewrite.so
    • Restart Apache
    • Restart MySQL
    • Go to https://localhost/security to make sure everything is secure. Ignore the warning about PHP not running in "Safe" mode.

     

    My book, MODX: The Official Guide - Digital Edition is now available here. The paper version of the book is available from Amazon.

    If you have the book and would like to download the code, you can find it here.

    If you have the book and would like to see the updates and corrections page, you can find it here.

    MODX: The Official Guide is 772 pages long and goes far beyond this web site in explaining beginning and advanced MODX techniques. It includes detailed information on:

    • Installing MODX
    • How MODX Works
    • Working with MODX resources and Elements
    • Using Git with MODX
    • Using common MODX add-on components like SPForm, Login, getResources, and FormIt
    • MODX security Permissions
    • Customizing the MODX Manager
    • Using Form Customization
    • Creating Transport Packages
    • MODX and xPDO object methods
    • MODX System Events
    • Using PHP with MODX

    Go here for more information about the book.

    Thank you for visiting BobsGuides.com

      —  Bob Ray