Installation

Installation layout

Only phpaga's htdocs/ directory needs to be read by the web server. All other directories can and should be outside the web server's document root. This can be achieved either by creating a virtual host and have it's document root point to the full path to htdocs/, or by installing phpaga completely outside the document root of an existing website and then adding an alias to the web server's configuration. This can be achieved under Apache with the following example:

  Alias /phpaga /usr/local/phpaga/htdocs/ 
    

If you can't modify the web server's settings (for example because you are using the services of a webhosting company) you should use the following strategy: Say your home directory is /home/exampleuser, and all your website content is stored under /home/exampleuser/www/. You copy phpaga to /home/exampleuser/phpaga/, move /home/exampleuser/phpaga/htdocs to /home/exampleuser/www/phpaga and mofidy /home/exampleuser/www/phpaga/config.php to include /home/exampleuser/phpaga/etc/config.php.

eZ Components

Install eZ Components into ext/ and rename the extracted directory to ezcomponents.

      % cd phpaga/ext
      % tar xjf ezcomponents-2007.1.1.tar.bz2
      % mv ezcomponents-2007.1.1 ezcomponents
    

Additional steps for the development version

If you fetched the source directly from phpaga's subversion repository you will need to perform the following steps. If you are installing an official package you can skip this section.

  1. Use the sample file etc/config.local.php_sample to create etc/config.local.php and fill in the necessary parameters.

  2. Give the web server full permissions to the files/ directory. This directory will contain the files users can upload and associate to objects (project, person, company, ...).

              % chown www-data files/
              % chmod 0700 files/
            

    If you do not have administrative rights on the server and therefore cannot change the directory's ownership, simply chmod 0777 the directory.

              % chmod 0777 files/
            

  3. Create a directory called templates_c in your phpaga-root directory (ie, /data/webs/phpaga/) and change its owner to your webserver's user (as the webserver has to write into it). Chmod it to 700. This directory is needed by Smarty, the template engine.

              % mkdir templates_c
              % chown www-data.www-data templates_c/
              % chmod 0700 templates_c/
            

    If you do not have root or sudo permissions on your server (as is the case in many shared hosting environments), then you must chmod the templates_c directory 0777, giving everyone permission to read, write and execute the compiled smarty templates:

              % mkdir templates_c
              % chmod 0777 templates_c/
            

Install required 3rd party packages

  1. If you have Smarty already installed on your server you can use it by editing the definition of SMARTY_DIR in etc/config.local.php accordingly.

            define("SMARTY_DIR", "/some/other/path/to/smarty/libs/");
          

    Otherwise install Smarty into ext/ (no need to change etc/config.local.php).

            [ % cd phpaga/ext ]
            % tar zxf Smarty-x.x.x.tar.gz
            % mv Smarty-x.x.x smarty
          

  2. Install the R&OS pdf class

            [% cd ext/ ]
            % mkdir pdfclass
            % cd pdfclass
            % unzip pdfClassesAndFonts_009e.zip
          

  3. Install smarty-gettext

            [% cd ext/ ]
            % tar xvzf smarty-gettext-1.0b1.tgz
            % mv smarty-gettext-1.0b1 smarty-gettext
          

The database

Create a database and a database user with the necessary permissions and set the appropriate configuration settings in the file etc/config.local.php accordingly. Make sure the database is able to hold unicode/utf-8. We will name both the database and the user "phpaga" in the examples provided below.

If you are using phpaga with a webhosting provider, chances are that the provider will create the database for you and give you the credentials.

If you are upgrading from a previous version of phpaga refer to the section Upgrading phpaga. For information about converting from MySQL to PostgreSQL read the section Migrating phpaga from MySql to PostgreSQL.

For PostgreSQL

Note: If you are using PostgreSQL 8.x, use 'UTF8' as the encoding of the database. For PostgreSQL 7.x, use the encoding 'UNICODE'.

 
    % psql template1
    template1> create database phpaga with encoding 'UTF8';
    template1> create user phpaga password 'yourpasswd';
    template1> grant all on database phpaga to phpaga;

     

Depending on your setup, you may also need to modify pg_hba.conf. This file is part of PostgreSQL and controls which hosts are allowed to connect, how clients are authenticated, which PostgreSQL user names they can use, which databases they can access. Refer to the PostgreSQL documentation if you are unsure about the proper settings.

For MySQL

 
    % mysql -uroot -p mysql
    mysql> create database phpaga default character set utf8 collate utf8_general_ci;
    mysql> grant all on phpaga.* to phpaga@localhost identified by 'yourpasswd';
    mysql> flush privileges;