Enabling PHP extensions
Some of the most advanced analysis rules applied by SymfonyInsight require to run your application. For that reason, if your project depends upon some PHP extensions to work, you need to enable them manually before analyzing your project:
- Click on the
Edit project
link at the top right of a project or analysis page. Enable the PHP extensions in the
Configuration
option using the php_ini configuration setting. You can use the following sample configuration as reference:1 2 3
php_ini: | extension=mcrypt.so extension=openssl.so
The following PHP extensions are natively supported by SymfonyInsight:
1 2
apcu, bcmath, bz2, curl, gd, gettext, gmp, iconv, intl, mbstring, mcrypt, mysql, openssl, pcntl, pdo_mysql, pdo_pgsql, readline, soap, xsl, zip, zlib
- Click on the
Update
button and the changes will take effect in the next analysis.
Example: analyze a project that uses MongoDB
Follow these steps to enable MongoDB for every project that requires it:
- Click on the
Edit project
link at the top right of a project or analysis page. Install the MongoDB PHP extension and enable it by adding the following custom configuration:
1 2 3 4 5
pre_composer_script: | yes '' | pecl install mongo php_ini: | extension=mongo.so
- Click on the
Update
button and the changes will take effect in the next analysis.
Installing and enabling PECL extensions
If your project needs any other PHP extension available at
PECL you can install them using the
pre_composer_script configuration option. The following example shows how
to download, install and enable the proctitle-alpha
extension:
1 2 3 4 5
pre_composer_script: |
pecl install proctitle-alpha
php_ini: |
extension=proctitle-alpha.so
If the PHP extension installation asks questions, you can keep the
default values by using the yes ''
command:
1 2 3 4 5
pre_composer_script: |
yes '' | pecl install apcu
php_ini: |
extension=apcu.so