Setting up the Library

shatsar edited this page Nov 17, 2011 · 1 revision
Clone this wiki locally

You will need PHP 5 or later.

The Mashape PHP Library is built without requiring third-party dependencies, this provides a great compatibility with most of the environments.

Directory permissions

Once you have downloaded and installed the Mashape PHP Library, it's time to set the right permissions to its installation directory. The installation directory is the folder where the Mashape PHP Library was extracted to (for the purpose of this documentation I'll call it LIBRARY_PATH - for example if you have extracted it to the /var/www/mycomponent path, the LIBRARY_PATH will be /var/www/mycomponent). The web-user will need to have ownership of the directory, it could be www-data, apache 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. 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: ) 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 LIBRARY_PATH

Then you will need to make the LIBRARY_PATH readable, writable and executable by the web-user, by executing the following command:

chmod -R 775 LIBRARY_PATH

Configuring Apache

Make sure mod_rewrite is enabled (a2enmod rewrite). Note: at the first execution, the library will automatically create an .htaccess file containing the configuration for mod_rewrite. In order to setup your component to use the Mashape PHP Library, you'll need to setup a new directory to an existing virtual host with the following configuration: You could also create a new virtual host for the component. An alias has been set to call the component easily, in this case mycomponent. If you go to your browser to (replace according to the virtual host configuration) you should see a JSON response like: