Category: php

Solve Uncaught exception ‘Zend_Json_Exception’ with message ‘Decoding failed: Syntax error

Solve Uncaught exception ‘Zend_Json_Exception’ with message ‘Decoding failed: Syntax error

Using Zend_JSON for parse invalid JSON format like “pain in the neck”. If you got this kind of error while parse JSON : 1Uncaught exception ‘Zend_Json_Exception’ with message ‘Decoding failed: Syntax error Or maybe : 1Uncaught exception ‘Zend_Json_Exception’ with message ‘Decoding failed: Unexpected control character found I suggest to you, move into json_decode() from native …

+ Read More

Preg_replace regex delete tags link url completely with text inside using php

Preg_replace regex delete tags link url completely with text inside using php

We need to completely remove anchor links with text inside using PHP. Then, we can use preg_replace() and removing all tags links with string completely by : 1preg_replace(‘/<a[^>]*>(.*)</a>/iU’,”, $text); Or seconds alternative is : 1preg_replace(‘#(<a.*?>).*?(</a>)#’, ”, $text); Now you can remove / delete all anchor links 🙂

Run latest PhantomJS with shell_exec PHP on Ubuntu 11.10 Oneiric

Run latest PhantomJS with shell_exec PHP on Ubuntu 11.10 Oneiric

Running PhantomJS with exec() or shell_exec PHP and grab it results may lead you into several headache problems. Several web that talking how to run phantomjs in PHP just send me into fail results. I will show you several pitfalls for instance, here a small scripts to run PhantomJS : test.php : 1234<?php $result = …

+ Read More

How to install and solve problem php-pear Mediawiki TextWiki in Ubuntu

How to install and solve problem php-pear Mediawiki TextWiki in Ubuntu

I facing problem when parsing MediaWiki result using php-pear in Ubuntu 11.10 ( Oneiric ). It give me error result like this : 1234require_once(): Failed opening required ” Warning: require_once(Text/Wiki/Mediawiki.php): failed to open stream: No such file or directory in /usr/share/php/Text/Wiki.php on line 473 Fatal error: require_once(): Failed opening required ‘Text/Wiki/Mediawiki.php’ (include_path=’.:/usr/share/php:/usr/share/pear:/home/ubuntu/htdocs/…’) in /usr/share/php/Text/Wiki.php on …

+ Read More

How to solve tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267] app/tmp/cache/persistent/ is not writable [CORE/cake/libs/cache/ file.php, line 267]

How to solve tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267] app/tmp/cache/persistent/ is not writable [CORE/cake/libs/cache/ file.php, line 267]

Today i got this kind of error in my CakePHP 1.3. Here are the error code : 1tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267] app/tmp/cache/persistent/ is not writable [CORE/cake/libs/cache/ file.php, line 267] I tried to solve this by chmod and change permisssion recursive into app/tmp. 12cd app/ chmod 777 -R tmp Hey, after change permission, …

+ Read More

How to create template system layouts in CodeIgniter 2.0

How to create template system layouts in CodeIgniter 2.0

Templating in CodeIgniter, it’s mean we should make your own layouts system. If you have using CakePHP before, then you see there no automatic templating views in CodeIgniter. After searching and compare with anothers, i get Philsturgeon template is near with CakePHP template system ( http://getsparks.org/packages/template/show ). So, first step, download and install it. See …

+ Read More

Solving RSS Feed error in Codeigniter 2.0

Solving RSS Feed error in Codeigniter 2.0

There are several commmon error when building RSS Feed in CodeIgniter 2.0. Somehow we made mistakes and here are top list case. When we got ErrorException [ Parse Error ]: syntax error, unexpected T_STRING, this happen because you have PHP short_tags enabled, which means <? is shorthand for <?php and opens a PHP code block. …

+ Read More

How to fix Codeigniter blank / white page error

How to fix Codeigniter blank / white page error

Sometimes when we developing our Codeigniter application, suddenly it gave us White of Screen or blank page error. To solve this problem, we need to configure our PHP.ini to show error. So, if you using Ubuntu, go to /etc/php5/apache2/php.ini and edit : 12error_reporting = E_ALL | E_STRICT display_errors = On

How to use Zend Framework in CodeIgniter 2.0

How to use Zend Framework in CodeIgniter 2.0

Combine Zend Framework with Codeigniter will give great result and cutting development time. Intergrating Zend Framework into CodeIgniter 2.0 is very easy. First, you download new Zend Framework here . After downloading, unpack it package and get Zend folder. Put this Zend folder into app/libraries in CodeIgniter. Then, we create Zend libraries :