Thursday, April 25, 2013

Magento installation layout

I inherited Magento in a BitNami image. These are just my notes as I familiarize myself with Magento - probably not very reliable as I don't know much about it yet. Judging by the RELEASE_NOTES.txt file in htdocs, it is version 1.7.0.2. This is the 'Full Release' version of Community Edition currently available from the Magento Commerce download page. I don't know about the BitNami image version, but it too is quite recent.

Magento is installed to /opt/bitnami/apps/magento. It is accessed via an Apache virtual server, configured in /opt/bitnami/apache2/conf. The document root folder is /opt/bitnami/apps/magento/htdocs. Almost the entire Magento installation is within the htdocs folder.

Within /opt/bitnami/apps/magento there are:
  • conf (folder)
  • htdocs (folder)
  • licenses (folder)
  • scripts (folder)
  • updateip.backup (file)
The conf folder contains three files. One relates to Beetailer, which I assume relates to this Facebook integration software. Another is a bit of Apache configuration, which is included into the main Apache configuration in /opt/bitnami/apache2/conf/httpd.conf: this sets up aliases and directory permissions for the Magento installation but does not define the virtual website. Note that the permissions here are wide open for the htdocs folder, but there are .htaccess files that restrict permissions, so it is not a bad as it looks initially. Finally, there is magento_info.txt which contains an encryption key. This may be from BitName. It is vaguely described in their FAQ.

The htdocs folder contains the bulk of the Magento installation. More on that later.

The license folder just has a copy of the license under which the Magento Community Edition software is released.

The scripts folder contains a single sql script (beetailer.sql) which appears to be related to setup of the Beetailer software noted above.

Finally, updateip.backup. This file appears to be part of the BitNami image. It is renamed so that it doesn't run. According to the BitNami Magento FAQ, it is for updating the Magento configuration with the server IP at system boot. Advice for WordPress is to rename it, appending '.backup' to the name, if the server has already been configured. So, it seems a reasonably safe assumption that this file is not doing anything. It is an ELF executable, none the less.

The htdocs folder contains the installation of Magento, almost in its entirety.

Perhaps a good place to begin is with htdocs/.htaccess. This file limits access to the folder, which otherwise is wide open, and provides configuration for various Apache modules. Among other things, it defines the default directory index as 'index.php'.

There are five main php scripts:
  1. api.php
  2. cron.php
  3. get.php
  4. index.php
  5. install.php
The api.php script handles requests to the Magento API. It is part of the Mage_api2 package. I don't know anything about this yet.

The cron.php script handles routine processing. I understand this should be executed on a regular schedule (perhaps daily???) and, possibly among other things, is needed to maintain the Magento cache.

The get.php script appears to be for downloading resources. Again, I don't know anything about this, but at a quick read it looks like it handles returning resources either from the file system or the database.

The index.php script is the main Magento entry point. It handles routine access to the Magento site / store. This script itself is quite brief. It does a little initialization, loads the main Mage script and executes Mage::run().

The install.php script is part of an installation option. Rather than copy the entire Magento installation to the server, it is possible to copy a small subset, including install.php, the downloader folder, which contains code supporting download and installation of Magento, and, no doubt, some other bits of configuration (contained in a relatively small zip file available for download, I believe), then access install.php from the browser to downlaod and install the full Magento release, assuming the web server has sufficient permissions on the htdocs folder.

The app folder contains most of the Magento 'application'.

The downloader folder contains script and configuration for downloading and installing Magento, supporting the install.php script.

The errors folder contains script and resources for handling errors and returning error messages.

The includes folder contains just one file: config.php. In a default install, config.php does nothing. It has lines to set PHP named constants COMPILER_INCLUDE_PATH and COMPILER_COLLECT_PATH, but these are commented out.This relates to the Magento compiler, which can be used to assemble all the class files into a single folder. This compiler is described by Alan Storm, who has many excellent posts about Magento - well worth reading.

The js folder is misleading. It does contain a little javascript, but it also contains css files, various image files and more. I guess it contains the client side parts of the Magento application.

The lib folder contains various libraries and resources used by the Magento application (or constituting the Magento application, depending on how you look at it).

The media folder contains some image files, xml files and various cryptically named files. No idea about this yet.

The nbproject folder contains very little. There are references to Net Beans. No idea about this...

The pkginfo folder contains some 'metapackage' information files. Part of how Magento is packaged and distributed, I imagine.

The shell folder contains a few php scripts that are part of the Mage_Shell package, whatever that is.

The skin folder contains more css and image files. Presumably these are related to styling the Magento interface.

The var folder contains various more or less temporary files, including the Magento cache. Presumably this is mostly managed by the Magento application.

Otherwise, there are license files, release notes and a robots.txt file.

2 comments:

Unknown said...

magento extension development crucial for integrating upgrades.

Emy Watson said...

How to find Magento Extension Developer in USA?
Magento Custom Stock Status

Labels