Advanced Developer Getting Started
If you are a developer wanting to get started, here's the things you need to do. This page assumes you are starting with, essentially, nothing installed and you want to install each Ringside component manually (i.e. without using the full Ringside installer). This page is organized such that if you perform these steps in order from top to bottom, you will have a full Ringside development environment installed and runnable by the time you finish.
Note that if you already have some of these components installed already (like Apache, MySQL or PHP) you can skip those sections. Make sure, however, they are configured in such a way that enables Ringside to run - read the instructions on this page to make sure your configurations match those required by Ringside.
 | It's much easier to use the full Ringside installer to quickly get up and running. This page is for the curious and for those that want full, fine grained control over what gets installed on their box and where. If you are a social application developer (i.e. you want to write applications that deploy in Ringside, but you do not want to modify the Ringside code itself), you probably do not need to follow these steps - using the installer to get a Ringside Social Application Server quickly installed is usually what you want. However, if you want to run with the latest, bleeding-edge, Ringside code then this page is for you. |
Some of these instructions mention operating system-specific things. When this occurs, the instruction's target operating system(s) will be denoted with their appropriate icons: for Windows, for MacOS, for Linux.
Apache Web Server
- Download Apache 2.2 and install it per the online directions. We'll call the Apache installation directory <apache-install-dir>.
- Ringside needs the mod_rewrite module, so be sure to have this in your httpd.conf file (this is normally commented out, you just have to uncomment it:
- Determine that the installation was successful by starting the Apache Web Server and pointing your browser to http://localhost. If you installed or reconfigured Apache such that it listens on a port other than 80, make sure your URL reflects the port (e.g. http://localhost:8080). Your browser should show you a default index page.
- Determine the location of your Apache Web Server's document root (e.g. <apache-install-dir>/htdocs) - we'll call this <apache-docroot>.
MySQL Database
- Download the MySQL 5 Community Server
- Make sure you read the MySQL platform notes for your particular operating system for the most up-to-date MySQL installation instructions
You typically need to only download and install the MySQL "Windows Essentials" package
- Install the software based on what you downloaded. We will call the directory where you installed MySQL <mysql-install-dir>.
Run the installer and follow the prompts; go through the MySQL Server Instance Configuration Wizard to setup your database and its root password. For your development machine, it is usually OK to simply accept all the defaults in the Configuration Wizard, with the exception of the root password (which you have to supply to complete the wizard)
You have several options to install on UNIX. There are rpm-based installations and non-rpm installs. If you get a non-rpm tarball, you can run <mysql-install-dir>/configure which outputs some useful information and normally starts your MySQL server.
- To set your MySQL root password: <mysql-install-dir>/bin/mysqladmin -u root password 'new-password'
- It is recommended that you also download and install the MySQL Admin GUI Tools
- These tools allow you to administer (start/stop/configure) and query your MySQL, so they are useful in a development environment
MySQL Configuration
- Set a value for "sql-mode" in your my.ini (
) or my.cnf ( ) configuration file, so you enable STRICT_TRANS_TABLES. A typical sql-mode value could be something like this:
If you are using the "MySQL Administrator" GUI tool, this can be seen in the "Startup Variables" page, under the "Advanced" tab (look for the "SQL Mode" setting).
 | We want to ensure strict mode in order to catch bugs in our database access layer. You may encounter error or warning messages due to the enablement of strict mode. If you see these, please report them either in JIRA or on our forums so we can clean these up. |
Edit your my.cnf configuration file in order to explicitly tell your client where the UNIX socket is:
where the value is the location of your socket. Alternatively, you can create a symbolic link pointing to where the mysql.sock really lives:
(creating a symbolic link may be necessary if your MySQL was installed from the Ringside installer, because it is looking for mysql.sock in the tmp location under the MySQL install directory.)
Defining where the socket file is located will be necessary if your MySQL was built with --with-unix-socket-path whose value is different from your setting in the configuration file.
 | (this step may or may not be needed and depends on how MySQL was built and configured.) |
PHP
- Download PHP 5. The directory where you install it will be called <php-install-dir>.
- Create your initial php.ini configuration file
copy <php-install-dir>/php.ini-recommended <php-install-dir>/php.ini
cp <php-source-code-dir>/php.ini-recommended <php-install-dir>/php.ini
- Add PHP to your PATH environment variable
The PHP executable is found in <php-install-dir> on Windows. Add that directory to the %PATH% System environment variable
The PHP executable is typically found in <php-install-dir>/bin on UNIX. Confirm where your PHP executable is and add its directory location to your $PATH by making the necessary changes in .profile, .bashrc or whatever is appropriate for your shell environment.
Make sure TMP environment variable is set so SQLite uses it to store its database files. Otherwise, it may attempt to use C:\WINDOWS which is undesirable.
- Confirm all things are well by executing the following within a command prompt window:
- To further confirm the validity of your PHP installation, you can ask PHP to output its configuration information by executing the following within a command prompt window (
note: Windows users should replace the single-quotes with double-quotes for this command to work):
PHP Configuration
The <php-install-dir>/php.ini configures your PHP environment. It is heavily commented for documentation purposes. Here's some things you should consider configuring to customize your PHP.
- display_errors: set this to Off to prevent error messages from munging the HTML rendered by the browser
- log_errors: set this to On to ensure the error messages go to the error log file
- error_log: set this to a full pathname to a file where you want the error messages to be stored
- error_reporting: this should be set based on your personal preference. If you want all errors, warnings and notices logged, you can set this to E_ALL|E_NOTICE|E_STRICT. If you do not want all the noise produced by that, you can set this value to E_ALL|E_NOTICE, E_ALL & ~E_NOTICE or just E_ALL.
- doc_root: should point to your Apache's document root location, <apache-docroot>
- max_execution_time: this is the maximum execution time allowed for each script in seconds; most if not all the UI scripts will return in less than 30 seconds, but setting this to a default of 600 will allow our M3 scripts the proper time to execute (as of 5/23/2008, there has not been a need for anything this large, but I suspect in the future we will need to allow for large execution times for our management interface)
- memory_limit: the maximum amount of memory a script may consume should be defaulted to something like 128M - some of the Ringside scripts will need this much.
 | Once Apache is integrated with your PHP install, you must remember that whenever you change your PHP configuration, you need to be sure to restart your Apache Web Server so it can pick up your new PHP configuration changes. |
PEAR
PEAR (PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components. It is needed so you can download extensions to PHP that are required for Ringside to operate properly.
On UNIX, the PHP build will typically already have PEAR installed - its executable will be located in the same directory as the PHP executable. So there is nothing for UNIX users to do in this step. Execute pear config-show to confirm PEAR is available on your system. |
Run the <php-install-dir>/go-pear.bat script. This installs and configures PEAR. Once complete, you should now have a pear.bat executable in the same location where your PHP executable is - verify that you have this executable by asking PEAR to show you its configuration via the "config-show" command line argument: <php-install-dir>/pear.bat config-show
Phing
Now that PEAR is installed, you can use it to download and install some things - the first being Phing. Phing is a build tool that is used to produce artifacts necessary to run Ringside.
 | For those familiar with Java, you will notice that Phing is basically a PHP implementation of ANT. |
- See the Phing download page for more detailed information on how to install it. The basic commands you need to run to install Phing via PEAR is as follows:
- After you install Phing via those two commands, you should now have a "phing" executable in the same location where your pear and php executables are. Verify that you have this executable by asking Phing to show you its version via the "-v" command line argument
PHPUnit
Ringside uses PHPUnit as one of its testing frameworks. See http://phpunit.sourceforge.net/ and http://www.phpunit.de/.
- Install PHPUnit via PEAR
Doctrine
Doctrine is the ORM (Object Relational Mapping) implementation used for database abstraction. If you are familiar with Hibernate (for Java), Doctrine is "Hibernate for PHP". See http://www.phpdoctrine.org/
- Install Doctrine via PEAR
- pear channel-discover pear.phpdoctrine.org
- pear install pear.phpdoctrine.org/Doctrine-0.10.4
MDB2
MDB2 is a unified API for accessing databases and constructing SQL in a portable way. It is yet another database abstraction library. See http://pear.php.net/package/MDB2
- Install MDB2 via PEAR
- pear install pear/mdb2-beta
- Because we will want MDB2 to talk to a MySQL database, you need to install the MySQL MDB2 driver also
- pear install pear/MDB2-beta#mysql
Validate_Finance_CreditCard
Validates the format of credit card numbers, security codes and card types. This is a dependency for Payment_Process (see below). See http://pear.php.net/package/Validate_Finance_CreditCard.
- Pull down Validate_Finance_CreditCard via PEAR
- pear install pear/Validate_Finance_CreditCard-alpha
Payment_Process
Payment_Process is an extension that provides Ringside with a gateway-independent framework for processing credit cards and other electronic payments. See http://pear.php.net/package/Payment_Process
- Install Payment_Process via PEAR
- pear install --alldeps pear/Payment_Process-beta
Validate_US
A validator library that validates common data for US locales. See http://pear.php.net/package/Validate_US.
- Pull down Validate_US via PEAR
- pear install pear/Validate_US-beta
PhpDocumentor
PhpDocumentor is used when generating phpdoc documentation (see build-document.xml). You only need to install this if you plan on generating phpdoc yourself.
- Pull down PhpDocumentor via PEAR
- pear install pear/PhpDocumentor
Cache_Lite
 | The usage of Cache_Lite may go away in future Ringside versions so you may not need to do this step in the future. |
Cache_Lite is used as a caching mechanism within Ringside. See http://pear.php.net/package/Cache_Lite
- Install Cache_Lite via PEAR
- pear install pear/Cache_Lite
Enable Extensions
This section is for Windows only:
- Open <php-install-dir>/php.ini in an editor and change the value of the extension_dir setting so it points to the extensions bundled with PHP 5.
- extension_dir = <php-install-dir>\ext
- Uncomment the Tidy extension within your php.ini file
- Uncomment the CURL extension within your php.ini file
- Uncomment the XSL extension within your php.ini file
- Uncomment the MySQL extension within your php.ini file
- Uncomment the Mcrypt extension within your php.ini file
- Uncomment the SQLite extension within your php.ini file
- Uncomment the PDO extensions within your php.ini file - this includes the core extension and any DB extensions you will need
- extension=php_pdo.dll
- extension=php_pdo_mysql.dll
- extension=php_pdo_sqlite.dll
This section is for UNIX only:
- Nothing needs to be done to php.ini on UNIX if you followed the instructions found on this page (i.e. if you compiled the extensions directly into PHP via the --with build options). If you did not, you can add your own extension=xyz.so lines that mimic those described above to load in libraries at runtime.
Integrate PHP and Apache
Windows PATH Typically, the Apache Web Server is installed as a Windows Service that is configured to run as the "Local System Account". Because we will need to use some PHP extensions (e.g. the MySQL extensions), the Apache PHP module will need to be able to load in those extensions' DLL libraries. DLL libraries are usually found by searching the Windows PATH environment variable. The "Local System Account" has a very minimal PATH (it is the "System variables" PATH) and as such will not find your PHP extension DLLs (such as the libmysql.dll which ships in the install directory of the PHP 5's Windows distro). Because of this, you must put your PHP install directory in the system PATH or have your Apache Web Server start as another user - one that has the PHP installation directory in its PATH environment variable. Another solution is to not install Apache as a Windows Service and just start it manually, under your own user environment (which assumes your user environment has PHP in its PATH, which it most likely does if you are following the directions on this web page). |
- Load your Apache Web Server's httpd.conf file, typically located at <apache-install-dir>/conf/httpd.conf, in your favorite text editor
- Tell Apache that it should attempt to serve index.php if a directory is requested. Find something like this in the httpd.conf file:
and make sure "index.php" is specified in the DirectoryIndex setting, like this:
DirectoryIndex index.php index.html
- Add the following line at the bottom of your httpd.conf file (notice that if your Apache configuration directory is, for some reason, not called "conf", make sure you set this relative path appropriately - typically, however, the following is what you will need):
- Create a file called php.conf in the location mentioned in the above Include directive. Typically, you create php.conf in the same directory where your httpd.conf file is located (e.g. <apache-install-dir>/conf/php.conf). The contents of your new php.conf file should look something like this
Of course, if your <php-install-dir> is different than "C:/php" or "/home/php", you should use your actual PHP location in your php.conf file. Similarly, if your <apache-install-dir> is different than "C:/Apache" or "/home/apache", you should use your actual Apache location.
- Confirm that your Apache Web Server is successfully integrated with PHP
- Create a file called php-test.php in your <apache-docroot> directory
- This new <apache-docroot>/php-test.php file should contain the following:
- Point your browser to this PHP page (e.g. http://localhost/php-test.php). Your browser should show you the "PHP test is successful" message along with your PHP configuration.
Subversion
Access to the SVN repository can be done via the SVN command line or via a plug-in to your IDE.
- To run SVN commands independently of your IDE you can install SVN from subversion.tigris.org.
- Eclipse - Eclipse now hosts the Subversive plug-in which emulates to a great degree the built-in CVS features offered by Eclipse. To install the Eclipse Subversive SVN plug-in follow the Subversive directions here. Obviously, you first must have Eclipse installed - see below for those instructions.
- IntelliJ - IntelliJ has built-in support for SVN.
Checkout Ringside Sources
- Open a command prompt and cd to the directory where you want the Ringside sources to live, for example:
- Use svn co to checkout the code onto your box
- Anonymous users can checkout trunk from the read-only SVN repository:
 | After checking out the source code, you will have a directory "ringside" containing the full source tree of the project. We will call this "ringside" source code directory <project-root-dir>. |
Eclipse
 | This section assumes you will want to use the PHP Development Tools framework for the Eclipse platform. If you have some other PHP development IDE you want to use, you can skip this section. Of course, if you do choose to skip the installation of the Eclipse/PDT IDE, it is up to you to properly install and configure your PHP development IDE. |
- Eclipse requires a JRE 5 to run. If you do not have Java installed already do the following:
- Download and install the Eclipse/PDT project
- After installing Eclipse, you can optionally install the Subversive SVN plugin or another SVN plugin of your choice
- Create a Ringside PHP Project
- Select File > New > PHP Project from the Eclipse main menu
- Define the project name as "ringside"
- The project contents directory should be the location where you checked out the SVN source - i.e. what we called the <project-root-dir>.
- Tell Eclipse where your Ringside project's PEAR libraries can be found. To do this, select the top-most project node in your PHP Explorer view (named "ringside", unless you called your project something else), click the right-mouse and select the Properties option. In the left side of the Properties popup window, select the "PHP Include Path" option and traverse to the "Libraries" tab. You will want to add a class folder(s) that point to your PEAR installed libraries (click the "Add External Folder..." button and select the directories you want to add). Some things you might want to add are:
<php-install-dir>/PEAR
<php-install-dir>/lib/php
- If you want to use Subversive or another SVN plugin in conjunction with your Ringside project, you first must ensure you have an SVN plugin installed in Eclipse and then you need to tell Eclipse to use the SVN metadata found in your Ringside source (if you only want to use the "svn" command line tool, you do not need to perform this step). To do this, select the top-most project node in your PHP Explorer view (named "ringside", unless you called your project something else), click the right-mouse and select the Team > Share... option. Tell Eclipse you want to use the SVN metadata files already found in the local project directories. Once complete, you can use the Synchronize view and other SVN features directly from Eclipse.
 | SVN does not contain an Eclipse .project file or any other Eclipse config files. In the future, we might find it necessary to check in a shared copy of .project and other Eclipse config files, if we need to enforce certain coding standards or project configuration. |
Preparing to Run Ringside
 | This set of steps need only be performed once. Thereafter, only when you need to change a configuration setting (such as a database setting) and you do not wish to hand edit the appropriate configuration files will you have to run these steps again. |
- From within a command line shell, change to the <project-root-dir>/build#* cd <project-root-dir>/build
- In the /build directory there exists a build.properties file that contains some default settings used by the phing build system. Copy this file (calling the new file build.local.properties) and edit that file to customize it for your own development environment.
copy build.properties build.local.properties
cp build.properties build.local.properties
 | For a development environment, the settings of importance include:
- db.type: the type of database you are using; e.g. mysql
- db.server: the server hostname where your database is running; this can optionally include a port number in the format hostname:port (e.g. "127.0.0.1:3306")
- db.name: the database name to use; e.g. the MySQL schema
- db.user: the database username used when connecting to the database
- db.password: the database password used when connecting to the database
- social.key and social.secret should be set to some string (e.g. "MyDevKeys")
- [space].root (where [space] is "web", "demo" and "api") should each be set as commented in the properties file for a SVN development scenario
|
- Now run phing to produce your development Ringside build
- phing -f build-dev.xml
- This creates two files in your <project-root-dir>:
- ringside.conf - configuration file for Apache
- LocalSettings.php - a file included in many of Ringside's .php files to setup common properties
 | You should look at your generated LocalSettings.php file. There are a lot of configuration information set in this file and you should be aware of the things it sets for you. |
- Configure your Apache to run Ringside by editing your Apache's httpd.conf file and add the following line to the end of it:
- In your php.ini file, append to the value of "include_path" the full path to your <project-root-dir>. Remember, php.ini is typically located at <php-install-dir>/php.ini.
include_path=".;<pear-directory>;<project-root-dir>"
include_path=".:<pear-directory>:<project-root-dir>"
- If include_path does not yet exist in your php.ini, go to your test PHP page in Apache that we created earlier (http://localhost/php-test.php) and find the current value of include_path. Then, set include_path in your php.ini to that value, appended by <project-root-dir> (note that the path separator is OS-specific - semicolon for
Windows, colon for UNIX).
See Ringside Run!
- Restart your Apache Web Server to pick up the changes you made to httpd.conf
- Setup your database schema by viewing the setup page in your browser
- You are now ready to run Ringside!
- http://localhost/web/index.php
 | If you configured Apache to listen on a port that is different from the default of 80, make sure your URLs reflect your custom port |
Debugging in Eclipse
- Make sure you install a PHP debugger extension into your PHP environment
- Configure your PHP debugger extension in your php.ini file.
Remember that anytime you modify php.ini, you also need to restart Apache.
- Now you must set up some Eclipse workspace preferences.
- From the main menu, select Windows>Preferences to open the preferences editor.
- PHP>PHP Servers - make sure the default server's URL matches your environment or create your own server definition
- PHP>PHP Executables - make sure your PHP executable is defined here. If need be, click the "Search..." button and tell Eclipse where it can find your PHP installation so it can search for its executable.
- PHP>Debug - make sure to select your environment's appropriate PHP Debugger, Server, and PHP Executable
- Create a Debug Configuration
- Open the debug configuration dialog by either pressing the toolbar's debug configuration drop-down button or the main menu's Run>OpenDebugDialog... option.
- Select PHP Web Page and press the "new" button
- Select the Server Debugger that your PHP Executable supports and select the PHP Server that hosts your Ringside Application Server
- Define the file you want to debug, as selected from your project workspace
- The source code layout is different from how it is accessed by your browser, so you must de-select the "Auto Generate" checkbox and manually enter the URL context with the proper value (i.e. if you are debugging the "web/public/setup.php" file, you'll want to enter "web/setup.php" for your URL)
- Set some breakpoints in your source code
- Execute the debug configuration that you just created
- Once a breakpoint is reached, the debugger will be activated
 | Using Eclipse/PDT 1.0.2's debugger with XDebug version 2.0.3 does not work properly. You may notice that if you hit the "run" debug button (after you are done stepping, you can "run" to let the script complete), the browser continually "spins" forever. You will not see this behavior when using XDebug 2.0.2. This is a known bug in Eclipse/PDT 1.0.2 and is fixed in Eclipse/PDT 1.0.3. |
 | As you debug, if the browser output isn't showing data as you would expect, try to set implicit_flush = On in your php.ini and see if that corrects the behavior. |
Profiling
Now that you set up XDebug, you can use it to profile the Ringside Server. Simply set the value of xdebug.profiler_enable to "1" in your php.ini file, restart Apache and submit requests to the Ringside Server. In the XDebug output directory (also defined in php.ini) you will see files called cachegrind.out.###. These contain your profile data. Use a tool such as ( )WinCacheGrind or ( )KCacheGrind to analyze your profile data.
 | The profile data files get very large, very quick. Disable the profiler when you are done profiling and be sure to remove any profile data files you no longer need - your file system will fill up rapidly if you do not manage your data files properly. |
Build Scripts
The Ringside code includes several build scripts that you can use to do things such as build client distros, publish phpdoc documentation and run tests (among other things). If you want to learn about the build system and what the scripts give you the ability to do, see the Build System wiki page.
Coding Standards
A coding standard for the Ringside code base has been published. If you plan on adding code to the Ringside core, please follow the Coding Standards as best as possible.
|
|