Tag: PHP

  • Ubuntu 10.04: Setup APC for PHP 5.3 and Apache2

    Installing the APC (Alternative PHP Cache) using the php-apc package is straightforward: # sudo aptitude install php-apc # sudo /etc/init.d/apache2 restart Using the package php-apc installs APC 3.1.3p1. If you would like to use the most recent version 3.1.4 you can manually set up the PECL package as follows: Install the required packages: # sudo […]

  • PHP 5: Send HTTP post request with file_get_contents

    The following code snippet shows an easy way how to send a HTTP post request using the PHP function file_get_contents: $url = ‘http://server.com/path’; $data = array(‘key1’ => ‘value1’, ‘key2’ => ‘value2’) // use key ‘http’ even if you send the request to https://… $options = array(‘http’ => array( ‘method’ => ‘POST’, ‘content’ => http_build_query($data) )); […]

  • Ubuntu 10.04 & PHP 5.3: Installing pecl_http

    To install the pecl_http PHP extension on Ubuntu 10.04 follow the instructions below: Install the required packages: # sudo apt-get install php-pear php5-dev libcurl4-openssl-dev Install pecl_http: # sudo pecl install pecl_http Create file /etc/php5/conf.d/http.ini with the following content: extension=http.so Restart Apache2: # sudo /etc/init.d/apache2 restart After restarting the Apache2 web server a “http” section should […]

  • Ubuntu 10.04 & PHP 5.3: Setup PDFlib 6 with PECL

    If you want to use the (old) PDFlib 6 (because you have paid for a license), you will get the following error when you try to install the latest pecl pdflib package (version 2.1.8) for PHP 5.3: […] running: make /bin/bash /var/tmp/pear-build-root/pdflib-2.1.8/libtool –mode=compile cc -I. -I/tmp/pear/temp/pdflib -DPHP_ATOM_INC -I/var/tmp/pear-build-root/pdflib-2.1.8/include -I/var/tmp/pear-build-root/pdflib-2.1.8/main -I/tmp/pear/temp/pdflib -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext […]

  • CakePHP: Simple Google Analytics integration

    The easiest way to integrate Google Analytics’ JavaScript tracking code in your cake application is to add Google’s code snippet in the file app/views/default.ctp. To be a little more flexible you can store the tracker code in the application’s configuration file (/app/config/core.php). Moreover you can define a CakePHP (view) element that can be reused in […]

  • Ubuntu 9.10: Setup APC for PHP5 and Apache2

    Update 2010-09-25: There is a new blog post (“Ubuntu 10.04: Setup APC for PHP 5.3 and Apache2”) for Ubuntu 10.04. To set up the Alternative PHP Cache (APC) just follow the instructions below: Install the required packages: # sudo apt-get install php-pear php5-dev apache2-threaded-dev Install APC: # sudo pecl install apc Create file /etc/php5/conf.d/apc.ini with […]