-----Mensaje original-----
De: Guillem Torres [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 30 de abril de 2004 10:51
Para: '[EMAIL PROTECTED]'
Asunto: Mysql-Php-Apache contra AS400

 

 

 

Hola, buenas a todos.

 

Estoy intentando montar un servidor linux para acceder al servidor AS400 a trav�s de php (Los dos se encuentran en la misma red).El server linuxutiliza mandrake 9.2. A parte, seg�n lo que he leido, he instalado apache 2.0.47, php 4.3.2, mysql, unixodbc y el iseries ODBC driver. Tambi�n he configurado el dsn para poder acceder al server AS400. Una vez configurado, el apache funciona correctamente , ya que, puedo acceder a la p�gina de inicio. Tambi�n php ya que puedo utilizar como prueba����� <? Php phpinfo ()?> con el que me muestra la configuraci�n tanto del apache, como del php, como del ODBC. Y parece estar bien configurado pero al crear una p�gina php que acceda al AS400 (archivo adjunto) y utilizar la funcion odbc_connect(dsn,user,pwd) no funciona y el explorador me da como fallo “error: call to undefined function: ODBC_connect “. El problema es que el ODBC parece estar bien configurado pero , en cambio, no puedo utilizar ninguno de los comandos ODBC_funcion. La verdad, es que no se cual es el problema.

 

A parte, quisiera saber cual es la funci�n del mysql en todo este proceso, ya que en ning�n momento hago uso de �l. Tambi�n me gustar�a saber si se puede y ,en este caso, como se puede importar una db del AS400 al servidor mysql del server linux. Os paso tambi�n el resultado de <? Php phpinfo ()?>.

 

Muchas gracias por adelantado.

<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body>



<?php 
$dbname = "SAMPLE";
$username = "db2inst1";
$password = "ibmdb2";

// odbc_connect returns 0 if the connection attempt fails;
// otherwise it returns a connection ID used by other ODBC functions

#include('php_odbc_includes.h');

#putenv("ODBC INSTINI= etc/odbcinst.ini");
#putenv("ODBC INI= etc/odbc.ini");
#putenv("DB2INSTANCE=db2inst2");



        #$od = "Driver=iSeries Access OD; Server=222.222.222.250; Database= UTILINFO";

        $db = odbc_connect("AS400","TORRESG","GTORRES")  or die ("No se conecta");
        
        
        
        

        

        
        
        $result = "select * from mydb.usinff";
        $result2 = odbc_exec($db, $result);

        $xnum = odbc_num_fields($result2);
        $rowNum = odbc_num_rows($result2);
        

                
                


 
 /*if ($rowNum > 0) {
    for ($j = 0; $j<$rowNum; $j++) {
 
       
 
        for ($k = 0; $k<$xnum; $k++) {
        
        ?> <TABLE>  <?php          
        echo "<td align=center>" . odbc_result($result2,$j, $k) . "</td>";
        ?> </TABLE <?php   
       }
 
        
 
    }
 }*/
 
 

                
                










?>








</body>
</html>
PHP Version 4.3.3 

System  Linux linux.redlotrans 2.4.22-10mdk #1 Thu Sep 18 12:30:58 CEST 2003 i686  
Build Date  Aug 27 2003 02:16:14  
Configure Command  './configure' '--prefix=/usr' '--exec-prefix=/usr' 
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' 
'--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/lib' 
'--localstatedir=/var/lib' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--enable-discard-path' '--disable-force-cgi-redirect' 
'--enable-shared' '--disable-static' '--disable-debug' '--disable-rpath' 
'--enable-pic' '--enable-inline-optimization' '--enable-memory-limit' 
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php' 
'--with-pear=/usr/share/pear' '--enable-magic-quotes' '--enable-debugger' 
'--enable-track-vars' '--with-exec-dir=/usr/bin' '--with-versioning' 
'--with-mod_charset' '--with-regex=php' '--enable-track-vars' '--enable-trans-sid' 
'--enable-safe-mode' '--enable-ctype' '--enable-ftp' '--with-gettext=/usr' 
'--enable-posix' '--enable-session' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-yp' '--with-openssl=/usr' '--without-kerberos' '--with-ttf' 
'--with-freetype-dir=/usr' '--with-zlib=/usr' '--with-zlib=/usr' 
'--with-zlib-dir=/usr'  
Extensions listed here are (or will be soon) available as external modules. To install 
one or all of these, use "urpmi" php-EXTENSION_NAME  mysql pgsql sqlite gd imap ldap 
bcmath bz2 calendar cpdf crack curl cyrus db dba dba_bundle dbase dbx dio domxml exif 
fbsql fdf filepro fribidi gmp hwapi hyperwave iconv imagick informix ingres_ii 
interbase ircg java mbstring mcal mcrypt mcve mhash mime_magic ming mnogosearch 
msession msql mssql ncurses notes oci8 odbc oracle overload ovrimos pam_auth pcntl pdf 
pfpro pspell qtdom readline recode rrdtool shmop snmp smbauth sockets swf sybase 
sybase_ct sysvmsg tokenizer wddx xml xmlrpc xslt yaz zip adodb mmcache apd cybercash 
cybermut mono mqseries netools python spplus spread inifile  
Server API  Apache 2.0 Handler  
Virtual Directory Support  disabled  
Configuration File (php.ini) Path  /etc/php.ini  
Scan this dir for additional .ini files  /etc/php  
additional .ini files parsed  /etc/php/23_gd.ini, /etc/php/34_mysql.ini, 
/etc/php/45_odbc.ini  
PHP API  20020918  
PHP Extension  20020429  
Zend Extension  20021010  
Debug Build  no  
Thread Safety  disabled  
Registered PHP Streams  php, http, ftp, https, ftps, compress.zlib  

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies  


--------------------------------------------------------------------------------

PHP Credits

--------------------------------------------------------------------------------

Configuration
PHP Core
Directive Local Value Master Value 
allow_call_time_pass_reference On On 
allow_url_fopen On On 
always_populate_raw_post_data Off Off 
arg_separator.input & & 
arg_separator.output & & 
asp_tags Off Off 
auto_append_file no value no value 
auto_prepend_file no value no value 
browscap no value no value 
default_charset no value no value 
default_mimetype text/html text/html 
define_syslog_variables Off Off 
disable_classes no value no value 
disable_functions no value no value 
display_errors On On 
display_startup_errors Off Off 
doc_root no value no value 
docref_ext no value no value 
docref_root no value no value 
enable_dl On On 
error_append_string no value no value 
error_log no value no value 
error_prepend_string no value no value 
error_reporting 2039 2039 
expose_php On On 
extension_dir /usr/lib/php/extensions /usr/lib/php/extensions 
file_uploads On On 
gpc_order GPC GPC 
highlight.bg #FFFFFF #FFFFFF 
highlight.comment #FF8000 #FF8000 
highlight.default #0000BB #0000BB 
highlight.html #000000 #000000 
highlight.keyword #007700 #007700 
highlight.string #DD0000 #DD0000 
html_errors On On 
ignore_repeated_errors Off Off 
ignore_repeated_source Off Off 
ignore_user_abort Off Off 
implicit_flush Off Off 
include_path .:/usr/lib/php/:/usr/share/pear/ .:/usr/lib/php/:/usr/share/pear/ 
log_errors Off Off 
log_errors_max_len 1024 1024 
magic_quotes_gpc On On 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off 
max_execution_time 30 30 
max_input_time 60 60 
memory_limit 8M 8M 
open_basedir no value no value 
output_buffering no value no value 
output_handler no value no value 
post_max_size 8M 8M 
precision 12 12 
register_argc_argv On On 
register_globals On On 
report_memleaks On On 
safe_mode Off Off 
safe_mode_exec_dir no value no value 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
sendmail_from [EMAIL PROTECTED] [EMAIL PROTECTED] 
sendmail_path /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i  
serialize_precision 100 100 
short_open_tag On On 
SMTP localhost localhost 
smtp_port 25 25 
sql.safe_mode Off Off 
track_errors Off Off 
unserialize_callback_func no value no value 
upload_max_filesize 2M 2M 
upload_tmp_dir no value no value 
user_dir no value no value 
variables_order EGPCS EGPCS 
xmlrpc_error_number 0 0 
xmlrpc_errors Off Off 
y2k_compliance On On 


apache2handler
Apache Version  Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) PHP/4.3.2  
Apache API Version  20020903  
Server Administrator  [EMAIL PROTECTED]  
Hostname:Port  linux.redlotrans:0  
User/Group  apache(76)/76  
Max Requests  Per Child: 0 - Keep Alive: on - Max Per Connection: 100  
Timeouts  Connection: 300 - Keep-Alive: 15  
Virtual Server  No  
Server Root  /etc/httpd/2.0  
Loaded Modules  core prefork http_core mod_so mod_access mod_auth mod_auth_anon 
mod_auth_digest mod_include mod_log_config mod_env mod_expires mod_headers 
mod_usertrack mod_setenvif mod_mime mod_status mod_autoindex mod_asis mod_info mod_cgi 
mod_vhost_alias mod_negotiation mod_dir mod_imap mod_actions mod_userdir mod_alias 
mod_rewrite mod_php4  

Directive Local Value Master Value 
engine 1 1 
last_modified 0 0 
xbithack 0 0 


Apache Environment
Variable Value 
HTTP_ACCEPT  image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*  
HTTP_REFERER  http://222.222.222.200/  
HTTP_ACCEPT_LANGUAGE  es  
HTTP_ACCEPT_ENCODING  gzip, deflate  
HTTP_USER_AGENT  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  
HTTP_HOST  222.222.222.200  
HTTP_CONNECTION  Keep-Alive  
PATH  /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin  
SERVER_SIGNATURE  <address>Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) 
PHP/4.3.2 Server at linux.redlotrans Port 80</address>  
SERVER_SOFTWARE  Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) PHP/4.3.2  
SERVER_NAME  linux.redlotrans  
SERVER_ADDR  222.222.222.200  
SERVER_PORT  80  
REMOTE_ADDR  222.222.222.36  
DOCUMENT_ROOT  /var/www/html  
SERVER_ADMIN  [EMAIL PROTECTED]  
SCRIPT_FILENAME  /var/www/html/prueba.php  
REMOTE_PORT  1304  
GATEWAY_INTERFACE  CGI/1.1  
SERVER_PROTOCOL  HTTP/1.1  
REQUEST_METHOD  GET  
QUERY_STRING  no value  
REQUEST_URI  /prueba.php  
SCRIPT_NAME  /prueba.php  


HTTP Headers Information
HTTP Request Headers 
HTTP Request  GET /prueba.php HTTP/1.1  
Accept  image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, 
application/msword, application/x-shockwave-flash, */*  
Referer  http://222.222.222.200/  
Accept-Language  es  
Accept-Encoding  gzip, deflate  
User-Agent  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  
Host  222.222.222.200  
HTTP Response Headers 
X-Powered-By  PHP/4.3.3  
Transfer-Encoding  chunked  
Content-Type  text/html  


ctype
ctype functions  enabled  


ftp
FTP support  enabled  


gd
GD Support  enabled  
GD Version  bundled (2.0.15 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
GIF Read Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  
XBM Support  enabled  


gettext
GetText Support  enabled  


mysql
MySQL Support enabled 
Active Persistent Links  0  
Active Links  0  
Client API version  4.0.15  
MYSQL_MODULE_TYPE  none  
MYSQL_SOCKET  /var/lib/mysql/mysql.sock  
MYSQL_INCLUDE  no value  
MYSQL_LIBS  no value  

Directive Local Value Master Value 
mysql.allow_persistent On On 
mysql.connect_timeout 60 60 
mysql.default_host no value no value 
mysql.default_password no value no value 
mysql.default_port no value no value 
mysql.default_socket no value no value 
mysql.default_user no value no value 
mysql.max_links Unlimited Unlimited 
mysql.max_persistent Unlimited Unlimited 
mysql.trace_mode Off Off 


odbc
ODBC Support enabled 
Active Persistent Links  0  
Active Links  0  
ODBC library  unixODBC  
ODBC_INCLUDE  -I/usr/local/include  
ODBC_LFLAGS  -L/usr/local/lib  
ODBC_LIBS  -lodbc  

Directive Local Value Master Value 
odbc.allow_persistent On On 
odbc.check_persistent On On 
odbc.default_db no value no value 
odbc.default_pw no value no value 
odbc.default_user no value no value 
odbc.defaultbinmode return as is return as is 
odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes 
odbc.max_links Unlimited Unlimited 
odbc.max_persistent Unlimited Unlimited 


openssl
OpenSSL support  enabled  
OpenSSL Version  OpenSSL 0.9.7b 10 Apr 2003  


pcre
PCRE (Perl Compatible Regular Expressions) Support  enabled  
PCRE Library Version  4.3 21-May-2003  


posix
Revision  $Revision: 1.51.2.2 $  


session
Session Support  enabled  
Registered save handlers  files user  

Directive Local Value Master Value 
session.auto_start Off Off 
session.bug_compat_42 On On 
session.bug_compat_warn On On 
session.cache_expire 180 180 
session.cache_limiter nocache nocache 
session.cookie_domain no value no value 
session.cookie_lifetime 0 0 
session.cookie_path / / 
session.cookie_secure Off Off 
session.entropy_file no value no value 
session.entropy_length 0 0 
session.gc_divisor 100 100 
session.gc_maxlifetime 1440 1440 
session.gc_probability 1 1 
session.name PHPSESSID PHPSESSID 
session.referer_check no value no value 
session.save_handler files files 
session.save_path /tmp /tmp 
session.serialize_handler php php 
session.use_cookies On On 
session.use_only_cookies Off Off 
session.use_trans_sid Off Off 


standard
Regex Library  Bundled library enabled  
Dynamic Library Support  enabled  
Path to sendmail  /usr/sbin/sendmail -t -i  

Directive Local Value Master Value 
assert.active 1 1 
assert.bail 0 0 
assert.callback no value no value 
assert.quiet_eval 0 0 
assert.warning 1 1 
auto_detect_line_endings 0 0 
default_socket_timeout 60 60 
safe_mode_allowed_env_vars PHP_ PHP_ 
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH 
url_rewriter.tags a=href,area=href,frame=src,input=src,form=,fieldset= 
a=href,area=href,frame=src,input=src,form=,fieldset= 
user_agent no value no value 


yp
YP Support  enabled  


zlib
ZLib Support  enabled  
Compiled Version  1.1.4  
Linked Version  1.1.4  

Directive Local Value Master Value 
zlib.output_compression Off Off 
zlib.output_compression_level -1 -1 
zlib.output_handler no value no value 


Additional Modules
Module Name 
sysvsem 
sysvshm 


Environment
Variable Value 
text_x  200  
text_y  300  
CONSOLE  /dev/console  
LOCPATH  /etc/locale  
progress  42  
INIT_VERSION  sysvinit-2.85  
text_color  0xeef4ff  
PATH  /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin  
vga  788  
RUNLEVEL  5  
runlevel  5  
devfs  mount  
resume  /dev/hda5  
splash_rc  yes  
PREVLEVEL  N  
previous  N  
SHLVL  2  
text_size  16  
splash  silent  
nbservices  48  
LOGO_CONSOLE  vt  
TEXTDOMAINDIR  /etc/locale  
_  /sbin/initlog  


PHP Variables
Variable Value 
PHP_SELF  /prueba.php  
_SERVER["HTTP_ACCEPT"] image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* 
_SERVER["HTTP_REFERER"] http://222.222.222.200/ 
_SERVER["HTTP_ACCEPT_LANGUAGE"] es 
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate 
_SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) 
_SERVER["HTTP_HOST"] 222.222.222.200 
_SERVER["HTTP_CONNECTION"] Keep-Alive 
_SERVER["PATH"] /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 
_SERVER["SERVER_SIGNATURE"] <address>Apache-AdvancedExtranetServer/2.0.47 (Mandrake 
Linux/6mdk) PHP/4.3.2 Server at linux.redlotrans Port 80</address>  
_SERVER["SERVER_SOFTWARE"] Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) 
PHP/4.3.2 
_SERVER["SERVER_NAME"] linux.redlotrans 
_SERVER["SERVER_ADDR"] 222.222.222.200 
_SERVER["SERVER_PORT"] 80 
_SERVER["REMOTE_ADDR"] 222.222.222.36 
_SERVER["DOCUMENT_ROOT"] /var/www/html 
_SERVER["SERVER_ADMIN"] [EMAIL PROTECTED] 
_SERVER["SCRIPT_FILENAME"] /var/www/html/prueba.php 
_SERVER["REMOTE_PORT"] 1304 
_SERVER["GATEWAY_INTERFACE"] CGI/1.1 
_SERVER["SERVER_PROTOCOL"] HTTP/1.1 
_SERVER["REQUEST_METHOD"] GET 
_SERVER["QUERY_STRING"] no value 
_SERVER["REQUEST_URI"] /prueba.php 
_SERVER["SCRIPT_NAME"] /prueba.php 
_SERVER["PHP_SELF"] /prueba.php 
_SERVER["PATH_TRANSLATED"] /var/www/html/prueba.php 
_SERVER["argv"] Array
(
)

 
_SERVER["argc"] 0 
_ENV["text_x"] 200 
_ENV["text_y"] 300 
_ENV["CONSOLE"] /dev/console 
_ENV["LOCPATH"] /etc/locale 
_ENV["progress"] 42 
_ENV["INIT_VERSION"] sysvinit-2.85 
_ENV["text_color"] 0xeef4ff 
_ENV["PATH"] /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 
_ENV["vga"] 788 
_ENV["RUNLEVEL"] 5 
_ENV["runlevel"] 5 
_ENV["devfs"] mount 
_ENV["resume"] /dev/hda5 
_ENV["splash_rc"] yes 
_ENV["PREVLEVEL"] N 
_ENV["previous"] N 
_ENV["SHLVL"] 2 
_ENV["text_size"] 16 
_ENV["splash"] silent 
_ENV["nbservices"] 48 
_ENV["LOGO_CONSOLE"] vt 
_ENV["TEXTDOMAINDIR"] /etc/locale 
_ENV["_"] /sbin/initlog 


PHP License
This program is free software; you can redistribute it and/or modify it under the 
terms of the PHP License as published by the PHP Group and included in the 
distribution in the file: LICENSE 

This program is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. 

If you did not receive a copy of the PHP license, or have any questions about PHP 
licensing, please contact [EMAIL PROTECTED] 
 

Responder a