Linux users: The process is almost the same. See the bottom of this page.
Propel is a wonderful object-relational mapping (ORM) tool for PHP5. It can significantly bring down the amount of time you spend on persistence related coding in your PHP application. Propel is ideally installed using 'pear' command. Here you need your computer connected to the Internet during installation. Also you need to have sufficient privileges to run the 'pear' command to install Propel. The other way would be to download the Propel distribution and perform an offline installation as detailed below. Advantages:
- You need not have the computer connected to the Internet.
- You can do this even in a shared hosting environment without having system administrative privileges.
While I haven't tested, if you want only to deploy a Propel based PHP application (but not to run propel-gen command), you probably need not worry about most of the steps. I guess you only need the PHP files found inside propel-extracted-dir/runtime/classes. You might try by copying the entire content inside that directory (including 'propel' directory) into your application or copy to somewhere else and add the location to the php include path (either by editing the php.ini or by calling the set_include_path() method).
But you need to follow all the steps below if you want to run the 'propel-gen' command.
Versions of software used (Hopefully other versions might also work):
- Propel 1.4.2
Download “Full Propel Package” from http://www.propelorm.org/
- Phing 2.4.1
Download “Full Phing Package” from http://phing.info/
- XAMPP (win 32) 1.7.3
Download from http://www.apachefriends.org/en/xampp.html . Linux users may not download XAMPP since Apache, MySQL, PHP installation using yum, apt-get or other package management software is much more convenient.
1. If you downloaded XAMPP, go about installing it. Selecting C:\ as the destination folder creates the C:\xampp directory at the end.
2. Create a new directory C:\php and extract Phing distribution to C:\php\phing.
3. Extract Propel distribution to C:\php\propel.
4. Go to My Computer -> Properties to edit environment variables.
5. Go to the environment variables section.
6. Go about creating a new system variable.
7. Define PHP_COMMAND variable as follows:
8. Define PHING_HOME variable:
9. Define PHP_CLASSPATH variable:
10. Go about editing the 'Path' environment variable.
11. Add '%PHING_HOME%\bin'
12. Also add 'C:\php\propel\generator\bin'
Now you can get a new command prompt and type the commands 'phing' and 'propel-gen'. They should work.
As said earlier, for PHP to locate the Propel related PHP files, edit the php.ini file or use the set_include_path() function to add C:/php/propel/runtime/classes to the PHP include path:
1. If you edit your php.ini, make the change like this (only add the last portion to the already existing value):
include_path = ".;c:\php\propel\runtime\classes"
2. If you use set_include_path() within PHP itself:
I have not tried offline installation of Propel on a Linux system. But I expect the following to work:
To set the environment variables, open and edit the /etc/profile file (or ~/.bash_profile if you want the commands only to be available for you, but not the other users). Add the following:
export PHP_COMMAND=/usr/bin/php export PHING_HOME=/opt/php/phing export PHP_CLASSPATH=/opt/php/phing/classes export PATH=$PATH:$PHING_HOME/bin:/opt/php/propel/generator/bin
The above assumes that you extracted Phing and Propel distributions to the /opt/php directory. If you used a different directory, correctly mention the same.
Similar to the Windows case, go about editing the /etc/php.ini file or use set_include_path() function in you PHP scripts to add Propel classes to the PHP include path.