How to check the PHP modules installed?

    The easiest way to test your PHP installation is to create a test script using the phpinfo() function. Open your favorite text editor and type:

    <?php phpinfo(); ?>
    

    Save the file as "phptest.php" in /installdir/apache2/htdocs/. Make sure Apache is up and running, open a browser and type http://localhost/phptest.php. You should then see a screen showing detailed information about the PHP version you are using.

    You can also running the following command:

    $ /installdir/php/bin/php -m
    

    PHP configuration file

    The PHP configuration file allows you to configure the modules enabled, the email settings or the size of the upload files. It is located at:

    BitNami Cloud Hosting and Virtual Machines

    Ubuntu: /opt/bitnami/php/etc/php.ini

    Amazon Linux / Red Hat Enterprise:  /etc/php.ini

    BitNami Installers

    linux_platform.png On Linux: /installdir/php/etc/php.ini

     

    win_platform.png On Windows: /installdir/php/php.ini

     

    mac_platform.png On OS X: /installdir/php/etc/php.ini


    How to modify the allowed size for uploaded files?

    You can modify the following option in the php.ini file to increase the allowed size for uploads:

    ; Maximum size of POST data that PHP will accept.
    post_max_size = 16M
    
    ...
    
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 16M
    

    How to modify the execution time?

    This paremeter sets the timeout for Apache to run a script. You can modify the following option in the php.ini file.

    max_execution_time = 120     ; Maximum execution time of each script, in seconds 
    

    How to install eAccelerator module?

    eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution.

    These are the steps to install this module on top of BitNami Stacks in Ubuntu Linux. For Windows systems you can download the module at http://www.sitebuddy.com/PHP/Accelerators/eAccelerator_windows_binaries_builds

    • Install the following packages:
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip
    
    $ wget https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.zip
    $ unzip eaccelerator-0.9.6.1.zip
    $ export PHP_AUTOCONF=/usr/bin/autoconf
    $ export PHP_PREFIX=/opt/bitnami/php
    $ cd eaccelerator-0.9.6.1
    $ /opt/bitnami/php/bin/phpize
    $ ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
    $ make
    $ sudo make install
    
    • Then, enable the module in the php.ini file:
    ...
    extension=eaccelerator.so
    ...
    
    • And check it, you can see something similar to this
    $ php -version
    
    Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
        with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
    

    How to install APC module?

    APC is an Alternative PHP Cache module. Most of the BitNami Stacks already include this module and you can check it at "/installdir/php/lib/php/extensions" folder. If the apc.so module exists, you only should enable it in the php.ini file.

    In case this module does not exist. You can install it manually. These are the steps to install it in an Ubuntu machine.

    • Install the following packages:
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • Download the latest source code from the web page, uncompress it and compile the module.
    $ wget http://pecl.php.net/get/APC
    $ tar -zxf APC*
    $ export PHP_AUTOCONF=/usr/bin/autoconf
    $ export PHP_PREFIX=/opt/bitnami/php
    $ cd APC-*
    $ /opt/bitnami/php/bin/phpize
    $ ./configure --enable-apc --enable-apc-mmap --with-php-config=$PHP_PREFIX/bin/php-config
    $ make
    $ sudo make install
    
    • Then, enable the module uncommenting the following lines in the php.ini file (remove ';' before each of them):
    ...
    extension = '/opt/bitnami/php/lib/php/extensions/no-debug-non-zts-20090626/apc.so'
    apc.enabled = 1
    ...
    
    How to check the APC cache usage?

    APC ships a PHP application to check the memory usage. It is only necessary to copy the "apc.php" file from the APC source files to the Apache htdocs folder.

    $ wget http://pecl.php.net/get/APC
    $ tar -zxf APC*
    $ cp APC*/apc.php /installdir/apache2/htdocs
    

    Then you can check the APC chached files at http://your_domain/apc.php

    How to install OAuth module?

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

    These are the steps to install it in an Ubuntu machine.

    • Install the following packages:
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • Download the latest source code from the web page, uncompress it and compile the module.
    $ wget http://pecl.php.net/get/oauth-1.2.2.tgz
    $ tar -zxf oauth*
    $ export PHP_AUTOCONF=/usr/bin/autoconf
    $ export PHP_PREFIX=/opt/bitnami/php
    $ cd oauth-*
    $ /opt/bitnami/php/bin/phpize
    $ ./configure
    $ make
    $ sudo make install
    
    • Then, enable the module adding the following line in the php.ini file:
    ...
    extension = '/opt/bitnami/php/lib/php/extensions/no-debug-non-zts-20090626/oauth.so'
    ...
    

    How to install Memcache module?

    Memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications.

    If this module is not in your Stack, you can install it manually. These are the steps to install it in an Ubuntu machine.

    • Install the following packages:
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • Download the latest source code from the web page, uncompress it and compile the module. I have downloaded the 2.2.4 version that it is the latest stable version at the time this writting.
    $ wget http://pecl.php.net/get/memcache-2.2.4.tgz
    $ tar -zxf memcache-2.2.4.tgz
    $ export PHP_AUTOCONF=/usr/bin/autoconf
    $ export PHP_PREFIX=/opt/bitnami/php
    $ cd memcache-2.2.4
    $ /opt/bitnami/php/bin/phpize
    $ ./configure --enable-memcache --with-zlib-dir=/opt/bitnami/common
    $ make
    $ sudo make install
    
    • Then, enable the module in the php.ini file:
    ...
    extension=memcache.so
    ...
    

    How to install Tidy module?

    Tidy is a binding for the Tidy HTML clean and repair utility which allows you to not only clean and otherwise manipulate HTML documents, but also traverse the document tree.

    If this module is not in your Stack, you can install it manually. These are the steps to install it in an Ubuntu Virtual Machine or AMI.

    • Install the following packages (they are already in the machine in recent versions)
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • Download the latest source code from the web page, uncompress it and compile the module.
    $ wget http://tidy.cvs.sourceforge.net/viewvc/tidy/tidy/?view=tar
    
    • Uncompress it and build the libraries
    $ cd /home/bitnami
    $ tar -xzvf tidy-tidy.tar.gz
    $ cd tidy/build/gmake
    $ make
    
    • Now download the PHP source code version that you are currently using from http://www.php.net and uncompress it. Then build the shared module for tidy:
    $ tar -xzvf php-<version>.tar.gz
    $ cd php/ext/tidy
    $ ./phpize
    $ ./configure --with-tidy=/home/bitnami/tidy
    $ make
    $ sudo make install
    

    How to install mod_geoip2 module?

    Mod_geoip2 module embeds GeoIP database lookups into the Apache web server. It is only capable of looking up the IP 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. These are the steps to install it in an Ubuntu Virtual Machine or AMI.

    • Install the following packages (they are already installed in the machine in recent versions)
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • In this case it is necessary the development files for libgeoip:
    $ sudo apt-get install libgeoip-dev
    
    • Download the latest source code from the web page, uncompress it and compile the module.
    $ wget http://www.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2-latest.tar.gz
    
    
    • Uncompress it and build the libraries
    $ tar -xzvf mod_geoip2-latest.tar.gz
    $ cd mod_geoip2_*
    $ sudo apxs -i -a -lGeoIP -c mod_geoip.c
    
    • The module is now available in /opt/bitnami/apache2/modules/mod_geoip.so. It is also automatically included in your Apache configuration. However, you will need to enable GeoIP in the Apache configuration adding the line "GeoIPEnable On" at /opt/bitnami/apache2/conf/httpd.conf. You can find other specific settings at http://dev.maxmind.com/geoip/mod_geo...onfiguration-2
    • Restart the Apache server.
    $ sudo /opt/bitnami/ctlscript.sh restart apache
    

    How to install Ioncube module?

    Ioncube makes it easy to protect your PHP 4 & 5 source code from easy observation, theft and change. You can add it manually on top of your existing appliance. These are the steps to install it in an Ubuntu Virtual Machine or AMI.

    • Copy the ioncube installation wizard php file to the htdocs directory:
    $ sudo cp ioncube/loader-wizard.php /opt/bitnami/apache2/htdocs/
    
    $ sudo cp -r ioncube/*.so /opt/bitnami/php/lib/php/extensions/
    $ ls -asl /opt/bitnami/php/lib/php/extensions/
    total 9104
    4 drwxr-xr-x 2 root root 4096 2012-04-18 13:13 .
    4 drwxr-xr-x 15 root root 4096 2012-02-22 17:37 ..
    196 -rwxr-xr-x 1 root root 193431 2012-02-14 11:41 apc.so
    320 -rwxr-xr-x 1 root root 320696 2012-04-18 13:13 ioncube_loader_lin_4.1.so
    320 -rwxr-xr-x 1 root root 320664 2012-04-18 13:13 ioncube_loader_lin_4.2.so
    320 -rwxr-xr-x 1 root root 320568 2012-04-18 13:13 ioncube_loader_lin_4.3.so
    336 -rwxr-xr-x 1 root root 337048 2012-04-18 13:13 ioncube_loader_lin_4.3_ts.so
    320 -rwxr-xr-x 1 root root 322872 2012-04-18 13:13 ioncube_loader_lin_4.4.so
    336 -rwxr-xr-x 1 root root 337048 2012-04-18 13:13 ioncube_loader_lin_4.4_ts.so
    332 -rwxr-xr-x 1 root root 335288 2012-04-18 13:13 ioncube_loader_lin_5.0.so
    348 -rwxr-xr-x 1 root root 349080 2012-04-18 13:13 ioncube_loader_lin_5.0_ts.so
    928 -rwxr-xr-x 1 root root 944184 2012-04-18 13:13 ioncube_loader_lin_5.1.so
    972 -rwxr-xr-x 1 root root 989688 2012-04-18 13:13 ioncube_loader_lin_5.1_ts.so
    932 -rwxr-xr-x 1 root root 948376 2012-04-18 13:13 ioncube_loader_lin_5.2.so
    1020 -rwxr-xr-x 1 root root 1038520 2012-04-18 13:13 ioncube_loader_lin_5.2_ts.so
    992 -rwxr-xr-x 1 root root 1011656 2012-04-18 13:13 ioncube_loader_lin_5.3.so
    1040 -rwxr-xr-x 1 root root 1059848 2012-04-18 13:13 ioncube_loader_lin_5.3_ts.so
    56 -rwxr-xr-x 1 root root 51160 2012-02-06 14:07 pdo_pgsql.so
    176 -rwxr-xr-x 1 root root 174552 2012-02-06 14:07 pgsql.so
    152 -rwxr-xr-x 1 root root 147956 2012-02-14 11:41 xcache.so
    
    • Add the following line at the end of the /opt/bitnami/php/etc/php.ini file:
    zend_extension = /opt/bitnami/php/lib/php/extensions/ioncube_loader_lin_5.3.so
    
    • Restart Apache web server:
    $ sudo /opt/bitnami/ctlscript.sh restart apache 
    
    • Go to the ioncube installation wizard and click a link to recheck the installation. You should see the following message:
    "Loader Installed Successfully. The ionCube Loader version 4.0.14 for PHP 5.3 is installed and encoded files should run successfully."
    

    How to install FreeTDS and MSSQL module?

    FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases. It is necessary to install the MSSQL module for PHP.  These are the steps to install it in a BitNami Ubuntu Virtual Machine or AMI.

    - Install FreeTDS.

    $ wget ftp://ftp.astron.com/pub/freetds/stable/freetds-stable.tgz
    $ tar zxf freetds-stable.tgz
    $ cd freetds-0.91/
    $ ./configure --enable-msdblib --prefix=/usr/local/freetds
    $ make
    $ sudo make install
    $ cd ..
    

    - Install MSSQL module for PHP.

    Compile the mssql extension and copy it to the PHP directory. Note that you should download the same PHP version that you are using. You can check the current PHP version with the "php -v"  command.

    $ wget http://us.php.net/distributions/php-5.3.10.tar.bz2
    $ tar jxf php-5.3.10.tar.bz2
    $ cd php-5.3.10/ext/mssql/
    $ phpize
    $ ./configure --with-mssql=/usr/local/freetds
    $ make
    $ sudo make install
    $ sudo cp modules/mssql.so /opt/bitnami/php/lib/php/extensions/
    

    How to send email via external SMTP account

    If you want to make sure your emails are delivered properly it is better to configure your PHP script or PHP based application with the external SMTP account. In the following example we will show you how to do it for Gmail account. It is enough to set proper host and username variables. Please note that the variables in your script/application may be different. You need Mail and Net_SMTP Pear modules installed to execute the script below:

    $ sudo /opt/bitnami/php/bin/pear install pear/Net_SMTP pear/Mail-1.2.0
    
    <?php
    require_once "Mail.php";
     
    $from = "myaccount@gmail.com";
    $to = 'test@mytest.com';
    
    $host = "ssl://smtp.gmail.com:465";
    $username = 'myaccount@gmail.com';
    $password = 'mypassword';
    
    $subject = "test";
    $body = "test";
    
    $headers = array ('From' => $from, 'To' => $to,'Subject' => $subject);
    $smtp = Mail::factory('smtp',
      array ('host' => $host,
        'auth' => true,
        'username' => $username,
        'password' => $password));
    
    $mail = $smtp->send($to, $headers, $body);
    
    if (PEAR::isError($mail)) {
      echo($mail->getMessage());
    } else {
      echo("Message successfully sent!\n");
    }
    
    ?>
    

    How to change the date or timezone

    The default timezone is "America/Los_Angeles" but you can change it in the php.ini:

    [Date]
    
    date.timezone = "America/Los_Angeles"
    

    You can see all available timezones at http://php.net/manual/en/timezones.php

    How in install IonCube extension?

    You can download the pre-compiled version and copy the .so file to php extensions directory. If you are on Linux you can use the "wget" command. In this example we are going to download the Linux 64 bit version.

    $ wget http://downloads2.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_5.3.so /installdir/php/lib/php/extensions/
    

    Add the following line to php.ini:

    zend_extension = /installdir/php/lib/php/extensions/ioncube_loader_lin_5.3.so
    

    Then restart the Apache server.

     

    How to install Solr module?

    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, you can install it manually. These are the steps to install it in an Ubuntu machine.

    • Install the following packages:
    $ sudo apt-get update
    $ sudo apt-get install build-essential libtool autoconf unzip wget 
    
    • Download the latest source code from the web page, uncompress it and compile the module:.
    $ wget http://pecl.php.net/get/solr-1.0.2.tgz
    $ tar -zxf solr-1.0.2.tgz
    $ export PHP_AUTOCONF=/usr/bin/autoconf
    $ export PHP_PREFIX=/opt/bitnami/php
    $ cd solr-1.0.2
    $ /opt/bitnami/php/bin/phpize
    $ ./configure --enable-solr --with-curl=/opt/bitnami/common --with-libxml-dir=/opt/bitnami/common
    $ make
    $ sudo make install
    
    • Then, enable the module in the php.ini file:
    ...
    extension=solr.so
    ...
    
     

    Comments

    You must login to post a comment.

    Attach file

    Attachments