The Way Of Life
Google

Monday, March 25, 2019

Error "Call to undefined function dbase_open()"

Call to undefined function dbase_open


Kali ini saya akan membagikan pengalaman saya ketika mendapatkan error pada aplikasi PHP ( Code  Igniter ) dalam menangani database yang menggunakan modul extension dbase. Untuk berikutnya tulisan akan saya tulis dalam bahasa inggris agar bisa bermanfaat bagi lebih banyak orang, tentu saja saya tulis dengan bantuan google translate dan saya perhalus lagi. Intinya tulisan ini adalah meng-enable-kan modul extension dbase pada PHP meskipun modul extension tersebut sudah ter-load.  

SLIK OJK

Aplikasi yang dibangun adalah aplikasi pelaporan SLIK untuk OJK yang dibangun oleh teman saya menggunakan Code Igniter dan interface ExtJS, menggunakan modul extension php dbase untuk mengolah database berupa file .dbf


A few weeks ago I found an error in my PHP application. The error message is Call to undefined function dbase_open (). When I checked at phpinfo.php (), the dbase module was loaded. 

dbase module loaded

But from the error message indicating that the function in the DBASE function does not exist. This of course confused me. 


Until finally after googling several hours I found that the extension module needed to be enabled even though the extension module was loaded (seen in phpinfo.php ).

### syntax

$ phpenmod MODULE_NAME

### Enable dbase php module
$ phpenmod dbase


### Disable dbase php module
$ phpdismod dbase


### List php extension modules ( enabled )
$ php -m


Previously I tried using the command

nm -D /usr/lib/php/20151012/dbase.so


to see a list of functions on the dbase.so file, but that didn't help much, until finally I found a solution that is enabling the module. and It Works!

Have Fun Guys!

tools :



Labels: , , , , ,

Thursday, June 25, 2015

ASCII to Entities


Kali ini saya ingin berbagi pengalaman ringan tentang karakter ASCII yang bermasalah pada saat digunakan di aplikasi web. Belum lama ini mendapat pesanan aplikasi desktop dan web yang mengakses satu database yaitu Microsoft SQL Server. Pesanan awal adalah aplikasi desktop yang dibuat dengan Visual Basic 6, kemudian ada permintaan dibuatkan aplikasi web juga. Akhirnya kami buat menggunakan PHP dengan CodeIgniter Framework yang ditanam di Web Server Linux Ubuntu 12.04. Koneksi PHP ke database Ms SQL Server 2000 menggunakan FreeTDS. Pada saat development menggunakan OS Windows 7 semua berjalan lancar tanpa ada masalah, tetapi ketika diupload ke web server Linux Ubuntu muncul masalah pada saat saat menampilkan data, setelah kami trace menggunakan firebug di Firefox muncul error pada json_encode, seperti di bawah ini.



A PHP Error was encountered

Severity: Warning

Message: json_encode(): Invalid UTF-8 sequence in argument

Filename: controllers/trskegiatan.php

Line Number: 90





Hal itu terjadi karena pada salah satu record yang tampil yaitu  terdapat karakter ASCII yang jika muncul di web berupa  \r\n yang menyebabkan error pada argument json_encode. Biasanya data tersebut import dari data Excel dan sejenisnya sehingga kurang "bersih". Setelah googling dan berjibaku selama dua hari akhirnya muncul beberapa solusi. Seperti setting FreeTDS ditambah client charset = UTF-8 dan sebagainya ternyata kurang manjur, akhirnya "resep" yang manjur adalah menggunakan fungsi Framework CodeIgniter yaitu :

ascii_to_entities()

Converts ASCII values to character entities, including high ASCII and MS Word characters that can cause problems when used in a web page, so that they can be shown consistently regardless of browser settings or stored reliably in a database. There is some dependence on your server's supported character sets, so it may not be 100% reliable in all cases, but for the most part it should correctly identify characters outside the normal range (like accented characters). Example:

$string = ascii_to_entities($string);


Dengan fungsi tersebut maka semua karakter ASCII pada data yang bisa menyebabkan masalah di browser langsung dikonversi.
Semoga artikel ini bisa membantu rekan -rekan.
 
tools:
Sencha ExtJS
Microsoft SQL Server 2000
Visual Basic 6
Linux Ubuntu 12.04
FreeTDS
CodeIgniter PHP Framework

Labels: , , , ,

Friday, July 19, 2013

Could not read font on CodeIgniter

Could not read font error messages on CodeIgniter in my case, it happen when my font file was broken. Font file broken can happened because bad connection when you upload your files via ftp. I've used captcha for login form that combined Sencha Extjs for UI dan CI for server side scripting. The solution is re-upload your font files dan make sure your font files is the good one, and the problem solved. In my case, my font files was broken so the file size has changed from 129.72 Kb to 48.48 Kb


That caused my login form cannot displayed like picture below


And the Code Igniter error messages


Labels: , , ,

Sunday, April 28, 2013

CodeIgniter cannot Insert NULL on MSSQL



Recently, I experienced a strange case when i was porting a desktop application to a web application. I am using CodeIgniter / PHP framework as a front end and for back end I am  using ExtJS, for Database Server I am using the Microsoft SQLServer.
When I run the store procedure from CodeIgniter,
the result  from stored procedures are not completed.But  if I run it from  Query Analyzer , it run perfectly and produces a perfect result . If in Query Analyzer success with 221 rows, in CodeIgniter / PHP only success with 107 rows. First analysis is due to time out, then I fix this by editing php.ini and increase the time out setting and the problems still occurs.

mssql.connect_timeout
mssql.timeout 

max_execution_time
max_input_time
 Then I optimize store procedures that previously when I run it, it takes almost 2 minutes to about 24 second, but it doesn't help.  I was desperate, until I tried to connect query using pure php command , that use  mssql_, from there I found out that there is an error that  CodeIgniter cannot insert NULL for a particular table.   

$proc = mssql_init('Store_Procedure_Name', $conn);
mssql_execute($proc);



And the error does not appear when I run it using modules from CodeIgniter, finally I fixed some code in stored procedures which is INSERT NULL value.  

ISNULL(field_name,' ') 

Finally IT SOLVED!, the store procedure runs perfectly when executed using CodeIgniter.

Some tips to avoid cases such as the above are:
1. Avoid NULL
value posibility on INSERT query you created.
2. Create 
query as simple as possible , that will help you when debuging in the future.

The conclusion is CodeIgniter refused INSERT NULL but will not display an error, while in Query Analyzer is  allow that to happen. This case maybe can make you confused when you convert from desktop applications to web applications. I hope these tips useful for you.

Labels: , , , ,