Php enable module debian

Install different PHP modules

To install a PHP module, the typical process is to install the module (either via the package manager or through a manual build/install process) and then activate it in the above configuration file. Find instructions for installing specific PHP modules.

NOTE: Bitnami stacks already include a number of PHP modules, which are installed but not active. Before installing a new module, check that it is not already included. If it exists, simply enable it in the PHP configuration file.

After modifying the PHP configuration file, restart both Apache and PHP-FPM for the changes to take effect:

$ sudo /opt/bitnami/ctlscript.sh restart apache $ sudo /opt/bitnami/ctlscript.sh restart php-fpm 

APCu

APCu is the APC User Cache module. It is already included in recent Bitnami Stacks by default. If that is not the case, install it manually following the steps below:

    Install the following packages:

 $ sudo apt-get update $ sudo apt-get install build-essential libtool autoconf unzip wget 
 $ wget https://pecl.php.net/get/apcu-X.Y.Z.tgz $ tar xzf apcu-X.Y.Z.tgz $ cd apcu-X.Y.Z $ phpize $ ./configure --with-php-config=/opt/bitnami/php/bin/php-config $ make $ sudo make install 

To enable the module, add the following line to the php.ini file:

MSSQL

Microsoft SQL Server is a relational database management system developed by Microsoft. The steps to install the module differ for PHP5 and PHP7, and Ubuntu and Debian. Choose the appropriate section below depending on the PHP version bundled with your stack and the platform. To obtain the PHP version, use the command php -v at your console prompt.

Installation

You need to install the PHP Linux Drivers for SQL Server. The process is different for Debian and Ubuntu.

Debian
 $ sudo su $ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - $ curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list $ curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list $ exit 
 $ sudo apt-get update $ sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools unixodbc-dev $ sudo pecl install sqlsrv $ sudo pecl install pdo_sqlsrv 
 $ extension=sqlsrv.so $ extension=pdo_sqlsrv.so 
Ubuntu:
 $ sudo su $ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - $ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list $ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list $ exit 
 $ sudo apt-get update $ sudo ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools unixodbc-dev $ sudo pecl install sqlsrv $ sudo pecl install pdo_sqlsrv 
 $ extension=sqlsrv.so $ extension=pdo_sqlsrv.so 

Testing

 $ setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $ try < $ $result = $conn->query('SELECT TOP 10 * FROM [master].[INFORMATION_SCHEMA].[TABLES]'); $ foreach ($result as $row) $ < $ print_r( $row ); $ >$ > catch (Exception $e) < $ echo $e->getMessage(); $ > $ ?> 

GeoIP2

Apache

The mod_geoip2 module embeds GeoIP database lookups into the Apache web server. It is only capable of looking up the IP address of a client that connects to the web server, as opposed to looking up arbitrary addresses.

If this module is not in your stack, you can install it manually following the steps below.

Читайте также:  Простейшие операторы в python

    Install the following packages if necessary:

 $ sudo apt-get update $ sudo apt-get install build-essential libtool autoconf unzip wget 
 $ sudo apt-get install libgeoip-dev 
 $ wget http://www.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2-latest.tar.gz 
 $ tar xzf mod_geoip2-latest.tar.gz $ cd mod_geoip2_* $ sudo apxs -i -a -lGeoIP -c mod_geoip.c 

NGINX

To compile and install the GeoIP2 module for NGINX, it is necessary to first download and compile NGINX from source with the GeoIP2 module included and then copy over the compiled module to the Bitnami stack’s existing NGINX installation. Follow these steps:

    Install the libmaxminddb-dev library:

 $ sudo apt-get install libmaxminddb-dev 
 $ wget https://github.com/leev/ngx_http_geoip2_module/archive/3.2.tar.gz $ tar xzf 3.2.tar.gz 
 $ wget http://nginx.org/download/nginx-1.18.0.tar.gz $ tar xzf nginx-1.18.0.tar.gz 
 $ cd nginx-1.18.0 $ ./configure --add-dynamic-module=PATH-TO-MODULE-DIRECTORY $ make 

This should create a compiled module file named objs/ngx_http_geoip2_module.so. Copy this file to the temporary directory.

 $ cp objs/ngx_http_geoip2_module.so /tmp/ 
 $ cd /opt/bitnami/nginx $ mkdir modules $ cp /tmp/ngx_http_geoip2_module.so /opt/bitnami/nginx/modules/ 
 load_module modules/ngx_http_geoip2_module.so; 

Imagick

The Imagick module is installed in Bitnami stacks, but is not enabled by default. To enable it, follow these steps:

    Uncomment or add the following line to the /opt/bitnami/php/etc/php.ini file:

IonCube

    Download the pre-compiled version and copy the .so file to the PHP extensions directory. It is very important to install the right version of ionCube taking into account the PHP version included in your solution. For example, if you want to install ionCube on WordPress and it uses PHP 7.0.27, you need to install the version 7.0 of ionCube.

NOTE: Y and Z are placeholders. Remember to replace them with the ionCube version number that matches your PHP version.

 $ wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz $ tar xvzf ioncube_loaders_lin_x86-64.tar.gz $ sudo cp ioncube/ioncube_loader_lin_Y.Z.so /opt/bitnami/php/lib/php/extensions/ 
 zend_extension = /opt/bitnami/php/lib/php/extensions/ioncube_loader_lin_Y.Z.so 

MongoDB

The Mongo PHP module is a MongoDB driver. It is already included in recent Bitnami Stacks, but not enabled by default. If it is not included in your installation, execute the command below to install the module:

$ sudo pecl install mongodb . Build process completed successfully Installing '/opt/bitnami/php/lib/php/extensions/mongodb.so' install ok: channel://pecl.php.net/mongodb-1.5.3 configuration option "php_ini" is not set to php.ini location You should add "extension=mongodb.so" to php.ini 

To enable the MongoDB module, follow these steps:

Читайте также:  Следующая строка в javascript

    Enable the module in the php.ini file:

OAuth

OAuth is an authorization protocol built on top of HTTP which allows applications to securely access data without having to store usernames and passwords.

    Install the following packages:

 $ sudo apt-get update $ sudo apt-get install build-essential libtool autoconf unzip wget libpcre++-dev libcurl4-gnutls-dev 
 $ wget http://pecl.php.net/get/oauth-2.0.5.tgz $ tar xzf oauth* $ cd oauth-* $ phpize $ ./configure $ make $ sudo make install 
 . extension = '/opt/bitnami/php/lib/php/extensions/oauth.so' . 

OCI8

To enable this module, check if the php.ini file includes the line extension=oci8.so. If so, uncomment it by removing the ; character:

If it is not included, it means the oci8 module is not included in your Bitnami stack. To compile and enable it, follow these steps:

    Compile and install the OCI8 module:

NOTE: These commands assume that the InstantClient Basic and SDK packages have been extracted and placed in the /home/bitnami/instantclient_19_6 directory. If the packages are in a different location on your system, update the paths shown in the commands below accordingly.

 $ cd /tmp $ wget https://pecl.php.net/get/oci8-2.2.0.tgz $ tar xzf oci8-2.2.0.tgz $ cd oci8-2.2.0 $ phpize $ ./configure --with-oci8=instantclient,/home/bitnami/instantclient_19_6 $ make $ sudo make install 
 export LD_LIBRARY_PATH=/home/bitnami/instantclient_19_6$

OpenSSL

The OpenSSL module for PHP is already enabled and no additional configuration is required.

pdo_ibm

To install and enable the PDO_IBM module, follow the steps below:

  • Download and install the IBM Data Server Driver Package for your platform from the IBM website.
  • Extract the package contents to your home folder and install it by running the following commands:
 $ cd /home/bitnami/dsdriver $ bash installDSDriver 
 $ wget https://pecl.php.net/get/PDO_IBM-1.3.6.tgz $ tar xzf PDO_IBM-1.3.6.tgz $ cd PDO_IBM-1.3.6 $ phpize $ ./configure $ make $ sudo make install 
 export LD_LIBRARY_PATH=/home/bitnami/dsdriver/lib$
 $ sudo /opt/bitnami/ctlscript.sh restart apache 
 $ /opt/bitnami/php/bin/php -m | grep ibm 

pdo_pgsql

This module is already included in Bitnami Stacks, but not enabled by default. To enable the pdo_pgsql module, edit the php.ini file and add the following line:

Redis

The phpredis extension provides an API for communicating with the Redis key-value store. Follow these steps to install it:

    Install the following package:

 $ sudo apt-get update $ sudo apt-get install -y autoconf 
 $ wget https://pecl.php.net/get/redis-VERSION.tgz $ tar xzf redis-VERSION.tgz $ cd redis-VERSION $ phpize $ ./configure $ make $ sudo make install 

More information can be found in the official documentation at https://github.com/phpredis/phpredis.

Solr

The Apache Solr PHP extension is an extremely fast, light-weight, feature-rich library that allows PHP applications to communicate easily and efficiently with Apache Solr server instances using an object-oriented API.

If this module is not in your stack, install it manually following these steps:

    Install and setup required system packages:

 $ sudo apt-get update $ sudo apt-get install build-essential libtool autoconf unzip wget libcurl4-openssl-dev libxml2-dev $ sudo ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl 
 $ wget http://pecl.php.net/get/solr-VERSION.tgz $ tar xzf solr-VERSION.tgz $ cd solr-VERSION 
 $ phpize $ ./configure --enable-solr $ make $ sudo make install 

SSH2

Install and enable the SSH2 module for PHP by following these steps:

    Install the libssl-dev package:

 $ sudo apt-get update $ sudo apt-get install libssl-dev 
 $ cd /tmp $ wget http://www.libssh2.org/download/libssh2-1.9.0.tar.gz $ tar vxzf libssh2-1.9.0.tar.gz $ cd libssh2-1.9.0 $ ./configure $ make $ sudo make install $ cd /tmp $ wget http://pecl.php.net/get/ssh2-1.2.tgz $ tar xzf ssh2-1.2.tgz $ cd ssh2-1.2 $ phpize $ ./configure --with-ssh2 $ make $ sudo make install 

Tidy

Tidy is a binding for the Tidy HTML clean and repair utility. This binding allows you to clean and manipulate HTML documents and traverse the document tree. This module is enabled by default. Confirm that the module is enabled with the following command:

$ sudo /opt/bitnami/php/bin/php -m | grep tidy tidy 

ZipArchive

ZipArchive is a class of the zip PHP module. This module is enabled by default. Check it with the following command:

$ sudo /opt/bitnami/php/bin/php -m | grep zip zip 

Here is a script named sample.php that lists the content of a zip file named sample.zip:

open('sample.zip'); for( $i = 0; $i < $za->numFiles; $i++ )< $stat = $za->statIndex( $i ); print_r( basename( $stat['name'] ) . PHP_EOL ); > ?> 

To use this script, create a sample.zip file and run this script at the server console, as below:

$ /opt/bitnami/php/bin/php sample.php 

Источник

Оцените статью