Link to home
Start Free TrialLog in
Avatar of Panchux
PanchuxFlag for Argentina

asked on

PHP script works from command line but not from Apache

I'm trying to query a DB2 database under an AS400 but when I run  the script I get an error

The query is:

SELECT * FROM DIVISA WHERE AÑO=11 AND MES=2 AND DIA=28

Open in new window


The error is:

Warning: odbc_exec(): SQL error: [unixODBC][IBM][Controlador ODBC de iSeries Access][DB2 UDB]SQL0104 - Texto de mensaje de error no disponible. El mensaje no se puede traducir satisfactoriamente., SQL state 37000 in SQLExecDirect in /srv/www/htdocs/tipoCambio.php on line 44 Error en odbc_exec

Open in new window


I know the query has a non english character so I guess it is an encoding problem. I've use mb_convert_encoding function to solve it but it was a no go. I also uncoment the AddDefaultCharset On under httpd.conf and add it to the .htaccess file in /srv/www/htdocs to no avail.

The scripts works ok through command line (php /srv/www/htdocs(tipoCambio.php) and under IIS7.

Database is IBM DB2 and I access it through unixODBC.

Any ideas will be much appreciated,

Pancho
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad you've got a working solution.  Please post your solution and accept it as the answer.  That way it will get into the PAQ and others can benefit from your research.

Thanks and regards, ~Ray
Avatar of Panchux

ASKER

A logical view was the only solution presented that really worked.