Category Archives: PHP related

How To Enable OCI8 on PHP 5.4 and Install Oracle Instant Client on Mac OS X 10.9 Maverick

After upgrading to OS X 10.9 Maverick, i’ve to reinstall PHP library and reconfigure it. Oracle OCI8 is one of PHP libraries which need to be reconfigured.

Today i spend more than 2 hours just to find out how to enable Oracle OCI8 in PHP 5.4.24. So I post it here just in case i have to reconfigure it again, i don’t have to feel the pain again.

Lets Start!

  1. Download Oracle Client Library from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
    You have to download 3 files:

    After downloading 3 files above, you have to extract instantclient-basic and instantclient-plus zip files into one folder, for example in “/Applications/instantclient”. And then create folder named “sdk” inside that folder, and extract instantclient-sdk into it.  And then add symbolic link using this command in Terminal:

    ln -s libclntsh.dylib.11.1 libclntsh.dylib

    Oracle Instant Client folder

    Oracle Instant Client folder (click picture to enlarge).

  2. Download oci8 tar PECL package from http://pecl.php.net/package/oci8
    After downloading package from pecl, extract it anywhere you like. And then open “Terminal” and go to that folder. Then run commands below.

    phpize
    ./configure --with-oci8=shared,instantclient,/Applications/instantclient
    make
    sudo make install

    Edit “/Applications/instantclient/” to the path where you extract Oracle Instant Client (point 1).

  3. Edit Apache plist file on /System/Library/LaunchDaemons/org.apache.httpd.plist
    Open Apache plist using text editor and then find Environment Key section. Add DYLD_LIBRARY_PATH key and your Oracle Instant Client folder as value.

    Editing Apache plist File

    Editing Apache plist File

  4. Open your /Users/yourusername/.bash_profile file using text editor, then add “export DYLD_LIBRARY_PATH=/Applications/instantclient/” (without quotes) at the end of file.
  5. Edit your php.ini and add “extension=oci8.so”
  6. Open terminal, and run this command : sudo apachectl restart
  7. Done! Open PHP Info

    oci8 has been installed

    oci8 has been installed

UPDATE:

If you still not getting it to work, check Sarah’s comment below.

Create PHP Configuration File on OS X 10.8 Mountain Lion

After installing and configure Apache, PHP, MySQL on OS X 10.8 Mountain lion, there is an error (warning) about date timezone on PHP because there is no timezone selected. After googling for a while, i didn’t found a solution.

PHP Configuration

PHP Configuration

 

Then i ask xikyu46, he replied that i should create a configuration file on default directory. The default configuration directory is located at /private/etc/. Create php.ini file. Set the timezone. And done.

Search Term Library For Codelgniter

Do you want to know how your user came to your website via search engine? User usually go to search engine like google and then type a search term and click link from search result page.  Search term can be used for analytic purpose, or search engine optimization (SEO) method.

First step to catch search term is getting the referrer. If referrer is a search engine, get the  search term, clean it from ‘bad words’ and return the result.  Simple, isn’t it? 🙂

WordPress community have a plugin to do the processes. And then i put some of its code to build library for CodeIgniter. You can download this library here.

Using this library is so simple.

$this->load->library(‘Terms_lib’);
$term = $this->terms_lib->search_term;

Done. 🙂

 

Sublime Text 2

Belakangan ini saya mulai beralih ke Sublime Text 2 sebagai default text editor saya. Desain yang simpel, ringan, dan powerful membuat saya kepincut. Dan juga versi trialnya unlimited. 😀

Salah satu yang menurut saya kurang adalah dukungan untuk remote file editing (FTP, SFTP, FTPS) secara native. Masih membutuhkan package tambahan yang kebetulan berbayar. Walau fitur ini masih bisa ‘diakali’ dengan mensetting default text editor pada FTP Client.

Sublime Text 2

Sublime Text 2

Sublime Text 2 ini tersedia untuk Mac, Windows, dan Linux!! Download disini!

PHP Framework Behind Indonesian News Website

I want to know what is php framework behind Indonesian News Website. Popular news website must be have heavy traffic. So they have to use optimal framework to serve users.

I try to make an error in URL , so the framework will print out an unique error.

1. Kompas.com

Kompas.com

Kompas.com

Kompas using CodeIgniter. Maybe version < 1.7.2, because version > 1.7.2 have different view in this error message.

 

2. Detik.com

Detik.com

Detik.com

Detik.com using PHPFuse.

3. Vivanews.com

Vivanews.com

Vivanews.com

Vivanews.com using CodeIgniter. Maybe same version with Kompas.

4. Okezone.com

Okezone.com

Okezone.com

Okezone.com using CodeIgniter. Maybe higher version than 1.7.2.

5. Metrotvnews.com

Metrotvnews.com

Metrotvnews.com

Metrotvnews.com using CodeIgniter.

 

More Information about CodeIgniter.

More Information about FusePHP.

 

Multiple Argument in CodeIgniter’ s Form Validation Callback

CodeIgniter have a powerful form validation class out of the box. We also can create our validation method using a callback. By default, “callback” just accept 1 argument. I didn’t found in user guide, how to make callback accept more than 1 argument.

But, after doing little googling i found a way to do it. For example:

$val->set_rules('field', 'Field Name', "trim|xss_clean|required|callback__example_callback[{$argument}]")
......

function _example_callback($default_argument, $argument) {

.......

See the bold text. Done. 🙂