We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11681
    • 98 Posts
    Having trouble installing MODX Revolution (Revo) on the latest XAMPP (version 1.8.3-3 at time of this writing) running on Ubuntu Linux (version 13.10 64-bit)? I have done it, but it is not pretty.

    Note to Moderator: I write these notes to explain how to make the system work AND to inspire an improved solution. Please remove this post as soon as it may become obsolete.

    Background
    Not long ago, installing Revo on XAMPP was simple: Unpack the Revo distribution within XAMPP's htdocs directory (For example, in /opt/lampp/htdocs/MyRevoInst/), start XAMPP, open a browser window to navigate to localhost/MyRevoInst/setup and follow the installation instructions.

    It is no longer so simple.

    In March of 2013, Apache Friends announced "joining forces" with BitNami to "take over maintenance of XAMPP." (http://www.apachefriends.org/blog/news-article-203924.html) BitNami's business is cloud hosting, and by controlling XAMPP, they are now better able to reach their goals.

    An unfortunate side effect of this arrangement is a change in XAMPP's file-use security scheme that complicates Revo installation on XAMPP. Either you accept BitNami's pushbutton Revo installation, or you deal with XAMPP security yourself. Further, running more than a single instance of any of the BitNami-supported pushbutton-installed subsystems is not possible (excepting for Wordpress) without considerable config hacking.

    Any Web project files or folders that are to be modified by Apache at run time (e.g., .../core/cache) must provide write privileges to the user under whose name Apache runs. The latest XAMPP sets that user to "daemon." Experiment shows that this name cannot be changed in the Apache configuration file, /opt/lampp/etc/httpd.conf, due to dependency elsewhere in XAMPP.

    Projects consisting of static HTML, or of PHP that does not alter project files, still work fine with the latest XAMPP. However, dynamic PHP-based subsystems such as MODX and other content managers must alter some of their own project files at both installation and run time. (MODX's built-in caching is a notable example of this requirement.) The latest XAMPP's file-use security does not support this dynamic behavior.

    Therefore, errors related to file-use privileges meet attempting to install MODX and run it using the latest XAMPP.

    Note: XAMPP offers security capability beyond file-use privilege, such as setting a password for phpMyAdmin. To avoid confusion, do not run XAMPP's security command, "sudo /opt/lampp/lampp security," until after you have managed to install Revo, successfully logged into the Manager and deleted Revo's .../setup directory.

    Solution Options
    1) GOOD IDEA: Use a Web stack other than XAMPP. Alternatives are available for Linux, and they've improved in ease of use. For example, see

    http://www.andyhawthorne.co.uk/installing-lamp-stack-ubuntu-13-10/

    or

    http://www.unixmen.com/install-lamp-server-apache-mysql-php-ubuntu-13-10-server/

    I suggest studying this option. Too bad, because XAMPP's features right out of the box are configured suitably for MODX.

    2) UNACCEPTABLE IDEA (to me, anyway): Use BitNami's pushbutton MODX installation. You'll be able to run one instance of the latest MODX version. You won't be able to use previous MODX installations and databases that you might have accumulated. See:

    http://wiki.bitnami.com/Infrastructure_Stacks/Bitnami_for_XAMPP

    http://bitnami.com/stack/modx

    http://wiki.bitnami.com/BitNami_Cloud_Hosting/Applications

    3) WORST IDEA EVER: Work around XAMPP's file-use security by making all of your project files writable by any user. Your files are thus vulnerable to anyone logged into your system. Nonetheless, you'll find this recommended on certain user forums. Please do not do this to yourself!

    4) POOR IDEA: Work around XAMPP's file-use security by manually setting just the minimum subset of your MODX installation's files writable by "daemon." The result is a mixture of file ownerships within your MODX installation: Your user name owns some files and "daemon" owns others. It is awkward but not dangerous. Note that this option can provide convenient file access for only one user's account name; a team can't work together on a project.

    I have tried this. It works. The files & folders to cede to the ownership of "daemon" are:
    .../core/config/config.inc.php    You create this file before installation.
    .../setup/                        Revo installer includes this directory.
    .../core/cache/                   Revo installer includes this directory.
    .../core/cache/export/            You provide this directory before or after installation.
    .../core/cache/packages/          You provide this directory before or after installation.

    5) SOMEWHAT LESS POOR IDEA: Work around XAMPP's file-use security by adding the name "daemon" to your user group. This option works with multiple MODX projects. This option also works for multiple developers by adding "daemon" to everyone's user groups, allowing them to work together on the same project. However, doing this creates a security hole whereby a "bad guy" logged in as "daemon" could read and alter everyone's files. Also, it is one more thing you'll have to remember when fresh-installing Ubuntu and XAMPP.

    I have tried this. It works. I consider it the best option of a bad lot.

    Option 5 Step-by-Step
    No cut & paste terminal commands here, because that gets people into trouble. Read each step below and proceed only after you are confident in use of the relevant commands, or get help from someone knowledgeable.

    Linux terminal commands used in accomplishing the steps below:
    cd
    chmod
    chown
    id -G -n YourUserGroupName
    id daemon
    ls -l
    sudo
    usermod

    Step 1: Assume a fresh XAMPP installation.

    Step 2: Add the name "daemon" to your user group.

    Step 3: Unpack the Revo distribution into /opt/lampp/htdocs. For example, let's say that the folder containing the distribution is /opt/lampp/htdocs/modx-2.2.8-pl/.

    Ensure that recursive ownership of all files & folders in this directory is with your own user name and user group. Also ensure that the group has recursive read & write privileges for this directory. Please check, since the unpacking process likely will assign ownership to "root" and group privilege as read-only, and that won't work.

    Step 4: Start XAMPP's Apache and MySQL services.

    Step 5: In a browser window, navigate to localhost/modx-2.2.8-pl/. You should observe a 503 error advising that the system could not load the MODX config file.

    Navigate to localhost/modx-2.2.8-pl/setup/. Follow the installer's prompting. Note: If you have not yet created the MySQL master login name and password, you'll be able to use the XAMPP default: Enter "root" for "Database login name" and just leave "Database password" blank.

    Assuming that all is well to this point, accept the Revo installer's invitation to log in.

    Step 6: Once logged into the Revo Manager, use System => Package Management to install any MODX extra you choose, Wayfinder, for example.

    Log out.

    If all worked as expected, congratulations! You have succeeded in installing and minimally testing MODX on XAMPP.

    If you look within /opt/lampp/htdocs/modx-2.2.8-pl/, you will note several files and directories that "daemon" created and therefore owns. You can leave them as is, or you can change their ownership to your name. Your new MODX installation works either way.

    Bonus: XAMPP Reference Page
    The old XAMPP Web site provided a handy reference to XAMPP commands and file locations on Linux. Please find this attached in both .pdf and .odt formats.

    Bonus: Protection from a Common Mistake Plus Added Convenience
    We are apt to make mistakes when testing software. A classic error is moving project files into XAMPP's /opt/lampp/htdocs in order to experiment, forgetting you've done that, and then deleting the entire directory. There goes your project!

    You can avoid this danger and make browsing your Web projects more convenient, too. The following procedure accomplishes this. It replaces Steps 3 through 5 above.

    Step 3a: Suppose your login name is "jack," and you keep your local Web files in /home/jack/MyProjects. Unpack the Revo distribution in some convenient directory relative to MyProjects, perhaps /home/jack/MyProjects/modx-2.2.8-pl/.

    Ensure that recursive ownership of all files & folders in this directory is in your own user name and user group. Also ensure that the group has recursive read & write privileges for this directory. Please check, since the unpacking process likely will assign group privilege as read-only, and that won't work.

    Step 3b: Create a symbolic link in /opt/lampp/htdocs that points to /home/jack/Myprojects:
    sudo ln -s /home/jack/MyProjects /opt/lampp/htdocs/MyProjects

    Step 3c: Having first saved a copy in case of error, edit file /opt/lampp/htdocs/index.php. The file contains:
    <?php
       if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
       $uri = 'https://';
       } else {
       $uri = 'http://';
       }
       $uri .= $_SERVER['HTTP_HOST'];
       header('Location: '.$uri.'/xampp/');
       exit;
    ?>
    Something is wrong with the XAMPP installation :-(


    See "xampp" near the end of the file? Replace "xampp" with the name of the symbolic link you just previously created. After that, the file should look like this:
    <?php
       if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
       $uri = 'https://';
       } else {
       $uri = 'http://';
       }
       $uri .= $_SERVER['HTTP_HOST'];
       header('Location: '.$uri.'/MyProjects/');
       exit;
    ?>
    Something is wrong with the XAMPP installation :-(


    Save the file and exit the editor.

    Step 4a: Start XAMPP's Apache and MySQL services.

    Step 4b: In a browser window, navigate to localhost. You should see a list of the MyProjects directory's contents. You can navigate to a project by clicking on its name.

    Step 5: Navigate to localhost/MyProjects/modx-2.2.8-pl/. You should observe a 503 error advising that the system could not load the MODX config file.

    Navigate to localhost/MyProjects/modx-2.2.8-pl/setup/. Follow the installer's prompting. Note: If you have not yet created the MySQL master login name and password, you'll be able to use the XAMPP default. Enter "root" for "Database login name" and just leave "Database password" blank.

    Assuming that all is well to this point, accept the Revo installer's invitation to log in.

    If now you should accidentally delete /opt/lampp/htdocs, you'll merely delete the symbolic link you created there. Your project files will be intact.

    For access to XAMPP's examples and tools, such as phpMyAdmin, navigate to localhost/xampp. [ed. note: halfnium last edited this post 12 years, 7 months ago.]
      I looked just like that in 1964.