Install Cocode
This page will be updated as the automated installer is created.
Cocode is available for checkout via Subversion. It is currently in a pre-alpha state, and tracking /trunk may lead to unstable or broken builds. You can check it out and play with it. If you notice problems, you can register on this site and submit a ticket. If you want to help work on it, you can send a message to me {at} jamessocol {dot} com.
System Requirements
- PHP 5.2.3 or higher. (may work as low as 5.2.0, unsupported)
- MySQL 5.
- PHP's MySQLi extension.
- diff or another diff utility. (optional)
- mod_rewrite. (for Apache. could be configured with other servers, unsupported)
My test environments are Windows XP, Vista, and Fedora, all running Apache, but it should run on any web server.
Getting the Source
Use SVN to check out the latest version of Cocode:
$ svn co svn://jamessocol.com/cocode/trunk ./cocode
SVN will create the following directory structure, the important parts are highlighted.
/cocode
/config <-- edit db.php, routes.php and possibly env.php for your local environment
/controllers
/helpers
/install
/db <-- run the SQL scripts in order
/javascript
/models
/system
/tmp <-- must be writeable by the web server
/views
Setting up the Database
You should create a dedicated user and database for Cocode. Maveric, the framework running Cocode, does not support table prefixes, and table names like users and comments could easily collide with other applications.
These instructions will assume your database and user name are both 'cocode', the password is 'password', and the host is 'localhost'. Replace these with the actual values.
Edit config/db.php
The file config/db.php should look like this:
<?php // Currently only supports MySQL // $db_type = 'mysql'; $db_host = 'localhost'; $db_user = 'cocode'; $db_pass = 'password'; $db_name = 'cocode'; $db_port = '3306'; $db_sock = NULL;
$db_port can be set to NULL to use the default (which is 3306, the default setting). If you connect through a socket, set $db_sock to the socket location. The MySQLi documentation contains more information about socket connections.
Creating the Database Tables
The directory install/db contains several .sql files which must be run in order. They are numbered from 000 and going up. These can be executed in any of several ways: uploaded to phpMyAdmin, run through the MySQL command line client, copied and pasted into either of those, etc.
I can't tell you how to access your database, but running them in order is important. There are at least two SQL statements in each file, so you will need to run them in a way that supports multiple statements.
Configuring the Base URL
Open up config/routes.php and edit the value of $base_url to be the base URL for Cocode.
For example, if my public web directory is /var/www/html and my Cocode installation is in /var/www/html/cocode, I should put in '/cocode' (no trailing slash).
Open up .htaccess (only the one in the root directory) and change RewriteBase to match.
Enabling diff
To enable diffs, you'll need to change the value of the diff_util setting. Cocode requires a diff utility that supports the -u switch for unified diffs, such as the GNU diff utility.
To change this setting, you will need to access the database, and do something along these lines:
UPDATE `settings` SET value = '<path to diff>' WHERE name = 'diff_util';
Final Steps
You should be done. If you are getting PHP E_NOTICE errors, make sure error reporting is turned off. If you set MAVERIC_MODE in config/env.php to 'production', all errors should be hidden.
If things aren't working, and you see no errors, make sure to set MAVERIC_MODE back to 'development', and set php_flag display_errors on in the .htaccess file.
Running It
Head to your Cocode installation, for example http://localhost/cocode, in your favorite browser. You can log in with the user name admin and the password password.
