Developer documentation

Principles

Apache

sudo apt-get install apache2 libapache2-mod-php5

Requirements:

> a2enmod rewrite

Apache config

Example

<VirtualHost *:80>
    ServerName publish.local
    ServerSignature Off

    DocumentRoot /var/www/publish/web
    <Directory /var/www/publish/web>
        Options -Indexes +FollowSymLinks +MultiViews
        php_admin_flag allow_url_fopen On
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog /var/log/apache2/publish_error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
</VirtualHost>

WARNING : if you use local name as above, please update your /etc/hosts file :

127.0.0.1    localhost
127.0.0.1    publish.local

NodeJS / less

> apt-get install nodejs npm node-less

If package is not available, use npm :

> cd /usr/local/lib/node_modules
> npm install less

Other dependencies

sudo apt-get install openjdk-7-jre

Git

> apt-get install git

PHP (v5.3.x)

Modules:
apc, Core, ctype, curl, date,dom, ereg, fileinfo, filter, gd (with jpeg support), hash, iconv, imagick, intl, json, libxml, mbstring, mcrypt, mhash, mongo, mysql, mysqli openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, session, shmop, SimpleXML, SPL, SQLite, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlwriter, zip, zlib

On Ubuntu 14.05

sudo apt-get install php5-apcu php5-curl php5-gd php5-imagick php5-intl php5-mongo php5-mcrypt php5-mysql php5-sqlite php5-tidy php5-cli

To check module use

php -m

For manual compilation:

> cd /root/install/php-x.x.xx
> ./configure '--prefix=/opt/php-5.3.25' '--with-config-file-path=/opt/php/' '--with-apxs2=/opt/httpd/bin/apxs' '--with-curl' '--with-openssl' '--with-libdir=lib64' '--with-gd' '--with-mysql=/opt/mysql/' '--with-pdo-mysql=/opt/mysql/' '--with-mcrypt' '--with-mhash' '--with-mysqli' '--with-tidy' '--enable-mbstring' '--enable-zip' '--enable-pcntl' '--with-jpeg-dir=/usr/lib64/' '--with-zlib' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg'
> make clean
> make
> make test
> make install
> /etc/init.d/httpd restart
> /opt/php/bin/php -m

php.ini

php_flag magic_quotes_gpc off

memory_limit = 256M
register_globals = Off
post_max_size = 2000M
upload_max_filesize = 2000M
max_file_uploads = 20
allow_url_fopen = On
date.timezone = Europe/Paris

short_open_tag=Off

; following is not necessary if using apt-get install
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so" 
extension=/usr/lib/php5/20090626+lfs/mongo.so
extension=mongo.so
extension=apc.so
extension=intl.so
extension=imagick.so
extension=uploadprogress.so

extension_dir = /usr/lib/php5/20090626+lfs/

[xdebug]
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log" 
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000

MongoDb (v2.4.3)

sudo apt-get install mongodb mongodb-clients

Database: bota
Collections: User, Database

> mongo
> use bota
> db.createCollection("User")
> db.createCollection("Database")
> quit()

Get Composer (Dependency Manager for PHP)

https://getcomposer.org/download/
Put the composer.phar file where the project directory will be created

cd /var/www/plantnet-publish
sudo php -r "readfile('https://getcomposer.org/installer');" | sudo php

Get copy

Fetch URL : http://amap-dev.cirad.fr/git/plantnet-publishv2.git

> git clone {Fetch_URL}
> cd plantnet-publishv2
> php ../composer.phar self-update
> php ../composer.phar install
> ./app/console assets:install --symlink
> ./app/console assetic:dump --env=prod

If memory errors:

> php -d memory_limit=-1 ../composer.phar ...

If Node path error

vi app/config/parameters.yml

and ajust path

User rights

chown -R www-data:www-data ./
chmod 755 -R ./

Create first user (super admin)

> cd {project_path}
> ./app/console fos:user:create
> ./app/console fos:user:promote {first_user} ROLE_SUPER_ADMIN

Mondo DB Admin

use Genghis : http://genghisapp.com/

Download zip and unzip it in /var/www/html (or other apache directory)
and go to http://localhost/genghis/genghis.php

Mail config

Edit app/config/parameters.yml

 mailer_host: smtp.cirad.fr
 mailer_user: null
 mailer_password: null

If no mail serveur is available, add in parameters.yml

    mailer_disable: true
    register_email_confirm: false

./app/console cache:clear --env=prod
chown www-data:www-data ./ -R

Common problems