Archive

Archive for the ‘symfony’ Category

Install Symfony 2 on Ubuntu 11.10 64 bits

July 20, 2012 2 comments

Let’s install Symfony 2.01.16 on Ubuntu 11.10 64 bits.

  • Download Symfony Standard Edition from http://symfony.com/download
  • Extract the contents to the web root (/var/www/)
  • Check the system configuration:

$ cd /var/www/Symfony

$ php app/check.php

********************************
* *
* Symfony requirements check *
* *
********************************

php.ini used by PHP: /etc/php5/cli/php.ini

** WARNING **
* The PHP CLI can use a different php.ini file
* than the one used with your web server.
* If this is the case, please ALSO launch this
* utility from your web server.
** WARNING **

** Mandatory requirements **

OK Checking that PHP version is at least 5.3.2 (5.3.6-13ubuntu3.8 installed)
[[ ERROR ]] Checking that the "date.timezone" setting is set: FAILED
 *** Set the "date.timezone" setting in php.ini (like Europe/Paris) ***
You must fix this problem before resuming the check.


$ php app/check.php
********************************
* *
* Symfony requirements check *
* *
********************************

php.ini used by PHP: /etc/php5/cli/php.ini

** WARNING **
* The PHP CLI can use a different php.ini file
* than the one used with your web server.
* If this is the case, please ALSO launch this
* utility from your web server.
** WARNING **

** Mandatory requirements **

OK Checking that PHP version is at least 5.3.2 (5.3.6-13ubuntu3.8 installed)
 OK Checking that the "date.timezone" setting is set
 OK Checking that app/cache/ directory is writable
 OK Checking that the app/logs/ directory is writable
 OK Checking that the json_encode() is available
[[ ERROR ]] Checking that the SQLite3 or PDO_<a class="zem_slink" title="SQLite" href="http://sqlite.org" rel="homepage" target="_blank">SQLite</a> extension is available: FAILED
 *** Install and enable the SQLite3 or PDO_SQLite extension. ***
You must fix this problem before resuming the check.

  • All you need is to install and enable the SQLite extension for Apache:

$ sudo apt-get install php5-sqlite

$ sudo /etc/init.d/apache2 restart

  • Recheck again, now I’m getting some warnings:

$ php app/check.php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/sqlite.so' - /usr/lib/php5/20090626/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
********************************
* *
* Symfony requirements check *
* *
********************************

php.ini used by PHP: /etc/php5/cli/php.ini

** WARNING **
* The PHP CLI can use a different php.ini file
* than the one used with your web server.
* If this is the case, please ALSO launch this
* utility from your web server.
** WARNING **

** Mandatory requirements **

OK Checking that PHP version is at least 5.3.2 (5.3.6-13ubuntu3.8 installed)
 OK Checking that the "date.timezone" setting is set
 OK Checking that app/cache/ directory is writable
 OK Checking that the app/logs/ directory is writable
 OK Checking that the json_encode() is available
 OK Checking that the SQLite3 or PDO_SQLite extension is available
 OK Checking that the session_start() is available
 OK Checking that the ctype_alpha() is available
 OK Checking that the token_get_all() is available
 OK Checking that the APC version is at least 3.0.17

** Optional checks **

OK Checking that the PHP-XML module is installed
 OK Checking that the token_get_all() function is available
 OK Checking that the mb_strlen() function is available
 OK Checking that the iconv() function is available
 OK Checking that the utf8_decode() is available
 OK Checking that the posix_isatty() is available
[[WARNING]] Checking that the intl extension is available: FAILED
 *** Install and enable the intl extension (used for validators) ***
[[WARNING]] Checking that a PHP accelerator is installed: FAILED
 *** Install a PHP accelerator like APC (highly recommended) ***
[[WARNING]] Checking that php.ini has short_open_tag set to off: FAILED
 *** Set short_open_tag to off in php.ini ***
 OK Checking that php.ini has magic_quotes_gpc set to off
 OK Checking that php.ini has register_globals set to off
 OK Checking that php.ini has session.auto_start set to off

** Optional checks (Doctrine) **

OK Checking that PDO is installed
 OK Checking that PDO has some drivers installed: mysql, sqlite

Let’s see the warnings one by one:

  • [PHP Warning] – Unable to load dynamic library ‘/usr/lib/php5/20090626/sqlite.so’: sqlite.so library relates to SQLite 2, which support was dropped via bug https://bugs.launchpad.net/ubuntu/+source/sqlite/+bug/747325. First ensure you have sqlite3.so in /usr/lib/php5/20090626 folder and then remove (or move) the sqlite.ini in /etc/php5/conf.d (ensure that you have also sqlite3.ini in the same folder):

$ cd /usr/lib/php5/20090626

$ ll sqlite*

-rw-r--r-- 1 root root 48480 2012-06-13 20:18 sqlite3.so

$ cd /etc/php5/conf.d

$ sudo mv sqlite.ini sqlite.ini_rm_20120720

  • [WARNING] Checking that the intl extension is available: install intl extension for php:

$ sudo apt-get install php5-intl

  • [WARNING] Checking that a PHP accelerator is installed: FAILED: Install a PHP Accelerator (you need pecl, so if you don’t have it installed, install php-pear package):

$ sudo pecl install APC

If you get this error:


/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
compilation terminated.
make: *** [apc.lo] Error 1
ERROR: `make' failed

Install this package and reinstall APC [updated 2012/08/17: install this package if you don’t find libpcre: libpcre3-dev]:


$ sudo apt-get install libpcre

$ sudo pecl install APC

Once installed, you have to add this line to /etc/php5/cli/php.ini (at the end of the file):


extension=apc.so

  • [WARNING] Checking that php.ini has short_open_tag set to off: just edit /etc/php5/cli/php.ini and modify this line:

short_open_tag = Off

  • Now let’s see this warning: The PHP CLI can use a different php.ini file than the one used with your web server. If this is the case, please ALSO launch this utility from your web server. So, open your broser and launch the check:

http://localhost/Symfony/web/config.php [recommended]

or

http://localhost/Symfony/app/check

  • I’ve had to modify the /etc/php5/apache2/php.ini file to add the correct timezone, add the extension=apc.so at the end of the file and modify open_short_tag to Off. Restart apache and recheck until you see no errors.

Once everything it’s fine, click on “Bypass configuration and go to the Welcome page”.

Categories: apache, linux, php, symfony, ubuntu Tags: , ,