Razo Duke12

Thursday, May 25, 2006

Problema configurar la extensión Mysqli para PHP5 en Debian.

Solución con ayuda de Garaged --como siempre pues jejeje:

Bajar un par de paketes de http://people.debian.org/~dexter/dists/php5.1/sid/binary-i386/:

dpkg -i php5.1-common_5.1.2-0.1+b1_i386.deb
php5.1-mysqli_5.1.2-0.1+b1_i386.deb

Un error ocurrio al querer instalar directo el pakete php5.1-mysqli_5.1.2-0.1+b1_i386.deb:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# dpkg -i php5.1-mysqli_5.1.2-0.1+b1_i386.deb
Selecting previously deselected package php5.1-mysqli.
(Reading database ... 80855 files and directories currently installed.)
Unpacking php5.1-mysqli (from php5.1-mysqli_5.1.2-0.1+b1_i386.deb) ...
dpkg: dependency problems prevent configuration of php5.1-mysqli:
php5.1-mysqli depends on php5.1-common (= 5.1.2-0.1+b1); however:
Package php5.1-common is not installed.
dpkg: error processing php5.1-mysqli (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
php5.1-mysqli


Ahora si ya tenemos los dos paketes:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# ll
total 164K
-rw-r--r-- 1 duke12 duke12 49K 2006-05-25 12:06 php5.1-mysqli_5.1.2-0.1+b1_i386.deb
-rw-r--r-- 1 duke12 duke12 103K 2006-05-25 12:16 php5.1-common_5.1.2-0.1+b1_i386.deb

Instalamos el primer pakete:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# dpkg -i php5.1-common_5.1.2-0.1+b1_i386.deb
Selecting previously deselected package php5.1-common.
(Reading database ... 80868 files and directories currently installed.)
Unpacking php5.1-common (from php5.1-common_5.1.2-0.1+b1_i386.deb) ...
Setting up php5.1-common (5.1.2-0.1+b1) ...

Instalamos el segundo pakete:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# dpkg -i php5.1-mysqli_5.1.2-0.1+b1_i386.deb
(Reading database ... 80897 files and directories currently installed.)
Preparing to replace php5.1-mysqli 5.1.2-0.1+b1 (using php5.1-mysqli_5.1.2-0.1+b1_i386.deb) ...
Unpacking replacement php5.1-mysqli ...
Setting up php5.1-mysqli (5.1.2-0.1+b1) ...

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# /etc/init.d/apache2 restart
Forcing reload of apache 2.0 web server....

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# /etc/init.d/apache2 stop
Stopping apache 2.0 web server....

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# /etc/init.d/apache2 start
Starting apache 2.0 web server....

Max nos recomendo ejecutar esta linea:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# dpkg --ignore-depends=php5.1-common -i php5.1-mysqli_5.1.2-0.1+b1_i386.deb
(Reading database ... 80897 files and directories currently installed.)
Preparing to replace php5.1-mysqli 5.1.2-0.1+b1 (using php5.1-mysqli_5.1.2-0.1+b1_i386.deb) ...
Unpacking replacement php5.1-mysqli ...
Setting up php5.1-mysqli (5.1.2-0.1+b1) ...


beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# ll /usr/lib/php5.1/20051025/
total 104K
-rw-r--r-- 1 root root 100K 2006-03-23 12:39 mysqli.so

Y tambien nos recomendo hacer este link:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# ln -s /usr/lib/php5.1/20051025/mysqli.so /usr/lib/php5/20051025/

Ademas de agregar la linea extension=mysqli.so al php-ini, kedando:

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# vi /etc/php5/apache2/php.ini
extension=mysql.so
extension=mysqli.so
extension=gd.so
extension=imap.so
extension=mcrypt.so

Reinciamos apache y listo!!!!!!!!

beto:/home/duke12/bto_06/PHP5_MYSQLI_DEBS/php5-mysqli-sid# /etc/init.d/apache2 restart

Forcing reload of apache 2.0 web server....

Visitados:
http://www.zend.com/php5/articles/php5-mysqli.php
http://mysql.gilfster.com/page.php?parent_id=4&page_id=4.0.3
http://forums.mysql.com/read.php?98,67948,67948#msg-67948
http://us2.php.net/mysqli
http://dev.mysql.com/doc/refman/5.0/en/php-mysql-mysqli.html

2 Comments:

  • $conn = mysqli_connect('192.168.0.3','a','');
    $db = mysqli_select_db($conn,'a');

    if(!$rs = mysqli_query($conn, 'CALL sp_listprojects(0)')){
    echo mysqli_error($conn);
    };
    if(mysqli_num_rows($rs) != NULL){
    while($row = mysqli_fetch_array($rs)){
    echo "projects ";
    }
    mysqli_free_result($rs);
    }


    if(!$rs = mysqli_query($conn, 'SELECT * FROM sys_issues WHERE id_employee=0')){
    echo mysqli_error($conn);
    };
    if(mysqli_num_rows($rs) != NULL){
    while($row = mysqli_fetch_array($rs)){
    echo "issues ";
    }
    mysqli_free_result($rs);
    }


    este codigo me tira error al ejecutarlo tal cual como esta... ahora si en la primer consulta tirada a la db en vez de llamar a un stored procedure pongo una consulta comun y corriente no tira ningun error....

    el error es el siguiente:

    Commands out of sync; you can't run this command now

    By Anonymous Anonymous, at 1:16 PM  

  • Dato1,
    * Columna2 => Dato2,
    * ...
    * }
    * Row2 {
    * Columna1 => Dato1,
    * Columna2 => Dato2,
    * ...
    * }
    * ...
    * }
    * DataSet2 {
    * ...
    * }
    * ...
    * }
    */
    private function rs_query( $query ) {
    // nuestro ResultSet
    $RS = array();
    // ¿Se ejecutó correctamente?
    if( $this->cnx->multi_query( $query ) ) {
    do {
    // ¿Hay datos?
    if( $result = $this->cnx->store_result() ) {
    // Un DataSet
    $DS = array();
    // Copiamos datos:
    while( $row = $result->fetch_assoc() ) {
    $DS[] = $row;
    }
    // Añadimos el DataSet al ResultSet
    $RS[] = $DS;
    // Liberamos resultado intermedio:
    $result->close();
    }
    // ¿Quedan datos?
    } while( $this->cnx->next_result() );
    }
    // Devolvemos el ResultSet con los DataSet
    return $RS;
    }

    ?>

    By Blogger victorhugo, at 3:54 PM  

Post a Comment

<< Home