Setting up Frapi
Clone this wiki locally
PHP Extensions and PEAR packagesDependencies,
You will need PHP 5.2.4 or later*
Frapi heavily relies on caching mechanisms as such as APC (See library/Frapi/Cache/) and therefore relies on a few PHP extensions and PEAR packages which are used to cache but also perform different actions across the administration interface and the API frontend.
- APC: Required for caching of actions, errors, etc. If you have xcache installed, you are going to see a weird “White Screen Of Death”. Disable xcache, enable apc and be done :)
- PEAR::HTTP_Request2: This could be replaced by pecl_http however it is used in the bundled ArmChair package which is used to access CouchDB
- “Gettext” : Used for the internationalisation of the administration interface.
Running Unit Tests
- PHPUnit: Required for running unit tests
- XDebug: Required for generating code coverage analysis reports
It is planned to eventually, in some time and space, to automatically verify against all dependencies automatically using Pyrus
Once you have downloaded Frapi, it’s time to extract it (If you used a git checkout keep reading on). Copy the archive of the Frapi version you downloaded into the folder you wish to serve your API from (This is the document root of the api and the administration interface).
For the purpose of this documentation section, let “FRAPI_PATH” be the directory where Frapi was extracted to. So if you downloaded Frapi and extracted it into the /var/www/api directory, the FRAPI_PATH will then be /var/www/api.
After extracting, you will need to verify and possibly change directory ownership and directory permissions on the FRAPI_PATH.
The web-user will need to have ownership of the FRAPI_PATH files. This user is sometimes apache, nobody, www-data, or some other user. Please refer to the documentation for your web server and operating system to determine the appropriate user if you are not sure. During development and testing (including production, in some cases) your user will need access to those files as well.
- First, determine the web-user’s group. This is usually named the same as the web-user
- Second, add yourself to the web-user group if you are not already a member (see Linux: Adding a user to a group)
- Finally, issue the chown command to change ownership of the FRAPI_PATH directories to be owned by yourself and the web-user group.
chown -R username.web-user FRAPI_PATH
After extracting you will need to give some directories some special permissions. You need to make sure that both FRAPI_PATH/src/frapi/custom/Action/ and FRAPI_PATH/src/frapi/custom/Config/ are readable, writable, and executable by the web-user, but only readable and executable to everyone else (0775). You also want to make sure that the XML files in FRAPI_PATH/src/frapi/custom/Config/ are readable and writable by the web-user, but only readable to everyone else (0664).
chmod 775 FRAPI_PATH/src/frapi/custom/Action
chmod 775 FRAPI_PATH/src/frapi/custom/Config
chmod 664 FRAPI_PATH/src/frapi/custom/Config/*.xml
Or if you are on linux you could run the setup.sh script which you can see the source in the tree:
sudo sh setup.sh