From Lazer
Home site
Install Propel with MySQL and Ubuntu install
- Install PEAR
- Use Synaptic type in "php-pear"
- Install php5-xsl for the xslt error not to show.
- Use Synaptic type in "php5-xsl"
- Install Phing 2.X
- pear channel-discover pear.phing.info
- pear install phing/phing
- Install Creole 1.x
- pear channel-discover pear.phpdb.org
- pear install phpdb/creole
- pear install phpdb/jargon
- Install Propel packages
- pear channel-discover pear.phpdb.org
- pear install phpdb/propel_generator
- pear install phpdb/propel_runtime
- Create schema.xml file
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<database name="<project name>" defaultIdMethod="native">
<table name="book" description="Book Table">
<column name="book_id" type="integer" primaryKey="true" autoIncrement="true" required="true" description="Book Id"/>
<column name="title" type="varchar" size="255" required="true" description="Book Title"/>
<column name="isbn" type="varchar" size="24" required="true" phpName="ISBN" description="ISBN Number"/>
<column name="publisher_id" type="integer" required="true" description="Foreign Key for Publisher"/>
<column name="author_id" type="integer" required="true" description="Foreign Key for Author"/>
<foreign-key foreignTable="publisher">
<reference local="publisher_id" foreign="publisher_id"/>
</foreign-key>
<foreign-key foreignTable="author">
<reference local="author_id" foreign="author_id"/>
</foreign-key>
</table>
<table name="publisher" description="Publisher Table">
<column name="publisher_id" type="integer" required="true" primaryKey="true" autoIncrement="true" description="Publisher Id"/>
<column name="name" type="varchar" size="128" required="true" description="Publisher Name"/>
</table>
<table name="author" description="Author Table">
<column name="author_id" type="integer" required="true" primaryKey="true" autoIncrement="true" description="Author Id"/>
<column name="first_name" type="varchar" size="128" required="true" description="First Name"/>
<column name="last_name" type="varchar" size="128" required="true" description="Last Name"/>
</table>
</database>
- Create build.properties file
# The name of the project
propel.project = <project name>
# The database driver
propel.database = mysql
# The connection parameters (optional)
propel.database.url = mysql://<username>:<password>@localhost/<project name>
#
- Create runtime-conf.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<config>
<propel>
<datasources default="<project name>">
<datasource id="<project name>">
<!-- the Propel adapter will usually be the same as phptype of connection DSN -->
<adapter>mysql</adapter>
<connection>
<phptype>mysql</phptype>
<database><project name></database>
<hostspec>localhost</hostspec>
<username><username></username>
<password><password></password>
</connection>
</datasource>
</datasources>
</propel>
</config>
- Place schema.xml, runtime-conf.xml and build.properties files in the home directory where your project (php files) is.
- Create the Database <project name> manually.
- Enter "propel-gen <full absolute path to your project>"
- Enter "propel-gen <full absolute path to your project> insert-sql"
- Create a php file in your project directory like below
<?php
require_once 'propel/Propel.php';
Propel::init("<full absolute path to your project>/bookstore/build/conf/bookstore-conf.php");
echo "Propel is working!!!";
?>
- Run you php file and see if it runs correctly.
- Copy the build/bookstore to <full absolute path to your project>.