PHP https://keopx.net/ es Pasar variales a un drupal_get_form() https://keopx.net/blog/pasar-variales-un-drupalgetform <span>Pasar variales a un drupal_get_form()</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item quickedit-field" data-quickedit-field-id="node/243/body/es/full"> <p>Pasar variales a un drupal_get_form()</p> <pre> <code class="language-php">drupal_get_form('avisame_form', $vars); function avisame_form($form, &amp;$form_state = NULL) { $args = $form_state['build_info']['args'][0]);</code></pre><p>Referencias:</p> <ul><li><a href="http://drupal.stackexchange.com/questions/10986/passing-arguments-to-drupal-get-form">http://drupal.stackexchange.com/questions/10986/passing-arguments-to-dr…</a></li> <li><a href="https://api.drupal.org/api/drupal/includes%21form.inc/group/form_api/7">https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7</a></li> </ul></div> </div> <span><span>keopx</span></span> <span><time datetime="2013-12-19T13:10:21+01:00" title="Jueves, Diciembre 19, 2013 - 13:10">Jue, 19/12/2013 - 13:10</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/drupal" hreflang="es">Drupal</a></div> <div class="field__item"><a href="/categoria/programacion" hreflang="es">Programación</a></div> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> <div class="field__item"><a href="/categoria/drupal-planeta" hreflang="es">Drupal Planeta</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/drupal" hreflang="es">Drupal</a></div> <div class="field__item"><a href="/tag/programacion" hreflang="es">Programación</a></div> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=243&amp;2=field_comments&amp;3=comment" token="iWa6mCPr2rP8OEwRz4gDAwK3ReYydRGFC9PrwzDHiPU"></drupal-render-placeholder> </div> </div> </section> Thu, 19 Dec 2013 12:10:21 +0000 keopx 243 at https://keopx.net Diferencias entre empty y isset en PHP https://keopx.net/blog/diferencias-entre-empty-y-isset-en-php <span>Diferencias entre empty y isset en PHP</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Me ha resultado interesante ver las diferencias entre ambos.</p> <p>Os dejo un enlace donde se explica perfectamente:<a href="https://gist.github.com/juampynr/6029872"> https://gist.github.com/juampynr/6029872</a></p> <p>Una tabla descriptiva:</p> <p style="text-align: center;"><img alt="" src="/sites/default/files/is_null-empty-unset.jpg" style="width: 408px; height: 460px;" /></p> <p>Gracias a <a href="http://about.me/juampy">Juampy</a> y <a href="https://www.linkedin.com/pub/rodrigo-alfaro/15/771/57">Rodrigo Alfaro</a></p> </div> <span><span>keopx</span></span> <span><time datetime="2013-12-01T20:10:33+01:00" title="Domingo, Diciembre 1, 2013 - 20:10">Dom, 01/12/2013 - 20:10</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/programacion" hreflang="es">Programación</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=241&amp;2=field_comments&amp;3=comment" token="nYtMCP_eeTEZ_3TEbZsmiqJ2sG5eq8EOjntVTpo3RVc"></drupal-render-placeholder> </div> </div> </section> Sun, 01 Dec 2013 19:10:33 +0000 keopx 241 at https://keopx.net Ver fichero de base de datos MySQL y Oracle en PHP https://keopx.net/blog/ver-fichero-de-base-de-datos-mysql-y-oracle-en-php <span>Ver fichero de base de datos MySQL y Oracle en PHP</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Este es el ejemplo de HTML donde ira incluida la imagen:</p> <p>Esta es tu imagen:</p> <pre> <code class="language-bash">&lt;img src="imagenscript.php?imname=casa_verano" /&gt;</code></pre><p>Ejemplo de imagen la imagen de verano.</p> <p>Ahora necesitas el script de PHP - llamado imagenscript.php en el directorio de ejemplo:</p> <pre> <code class="language-php">&lt;?php mysql_connect("localhost","user","password"); mysql_select_db("database"); $imagen = stripslashes($_REQUEST[imname]); $rs = mysql_query("select * from libreria_img where filename=\"". addslashes($imagen).".jpg\""); $row = mysql_fetch_assoc($rs); $imagebytes = $row[imgdata]; header("Content-type: image/jpeg"); print $imagebytes; ?&gt;</code></pre><p>Referencia:</p> <ul><li><a href="http://www.wellho.net/mouth/937_Display-an-image-from-a-MySQL-database-in-a-web-page-via-PHP.html">http://www.wellho.net/mouth/937_Display-an-image-from-a-MySQL-database-in-a-web-page-via-PHP.html</a></li> </ul></div> <span><span>keopx</span></span> <span><time datetime="2010-11-14T09:47:37+01:00" title="Domingo, Noviembre 14, 2010 - 09:47">Dom, 14/11/2010 - 09:47</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/oracle" hreflang="es">Oracle</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=200&amp;2=field_comments&amp;3=comment" token="W36o2PSuo6jEW-GHgkJ5tJgFfM7whxoPfhRFX28anW8"></drupal-render-placeholder> </div> </div> </section> Sun, 14 Nov 2010 08:47:37 +0000 keopx 200 at https://keopx.net Configuración de PHP 5.3 y xdebug https://keopx.net/blog/configuracion-de-php-53-y-xdebug <span>Configuración de PHP 5.3 y xdebug</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Tras un tiempo utilizando ambas herramientas en php5.2 ahora a tocado actualizar a la versión 5.3 de php.</p> <p>Realizando depuración de código me encuentro en que no me muestra los mensajes que me mostraba con php 5.2, no me los muestra en php 5.3.</p> <p>No solo eso sino que ni siquiera me los muestra. Parece ser que la nueva versión esta optimizada para un entorno de producción.</p> <p>Para ello php 5.3 nos proporciona una serie de fichero php.ini para poder configurar el entorno de desarrollo y el de producción.</p> <p><strong>php 5.3 para desarrollo</strong> Buscar fichero <em>php.ini-development</em> </p> <!--break--> <pre> <code class="language-bash">$ locate php.ini-development /usr/share/doc/php5-common/examples/php.ini-development</code></pre><p>Y ahora copiamos el fichero de desarrollo, realizando antes una copia del original:</p> <pre> <code class="language-bash">$ cd /etc/php5/apache2 $ sudo mv php.ini php.ini_original $ sudo cp /usr/share/doc/php5-common/examples/php.ini-development php.ini-development</code></pre><p>Buscamos y copiamos el de producción</p> <pre> <code>$ locate php.ini-production /usr/share/php5/php.ini-production /usr/share/php5/php.ini-production.cli</code></pre><p>Copiamos el del producción:</p> <pre> <code class="language-bash">$ sudo cp /usr/share/php5/php.ini-production php.ini-production</code></pre><p>Ahora copiamos el que nos interese segun el entorno.</p> <p>Desarrollo:</p> <pre> <code class="language-bash">$ sudo mv php.ini-development php.ini</code></pre><p>Producción:</p> <pre> <code class="language-bash">$ sudo mv php.ini-production php.ini</code></pre><p>Ahora ya reiniciamos el apache y listo:</p> <pre lang="bash" line="1" xml:lang="bash"> sudo /etc/init.d/apache2 restart</pre><p><strong>Xdebug para php 5.3</strong></p> <pre> <code class="language-bash">$ sudo nano /etc/php5/apache2/conf.d/xdebug.ini</code></pre><p>Y añadimos:</p> <pre> <code class="language-ini">zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp"</code></pre><p>* nueva ruta <em>zend_extension=/usr/lib/php5/20090626+lfs/</em> Reiniciamos apache:</p> <pre> <code class="language-bash">sudo /etc/init.d/apache2 restart</code></pre><p>Relacionado:</p> <ul><li><a href="https://www.keopx.net/blog/netbeans-php-y-xdebug">https://www.keopx.net/blog/netbeans-php-y-xdebug</a></li> </ul><p>Referencias:</p> <ul><li><a href="http://wiki.php.net/rfc/newinis">http://wiki.php.net/rfc/newinis</a></li> </ul></div> <span><span>keopx</span></span> <span><time datetime="2010-10-17T15:43:33+02:00" title="Domingo, Octubre 17, 2010 - 15:43">Dom, 17/10/2010 - 15:43</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/xdebug" hreflang="es">Xdebug</a></div> <div class="field__item"><a href="/tag/netbeans" hreflang="es">Netbeans</a></div> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=196&amp;2=field_comments&amp;3=comment" token="6atBXafYmezHMGVvYhfGcrsaGyBRagKIti1idGP7_ss"></drupal-render-placeholder> </div> </div> </section> Sun, 17 Oct 2010 13:43:33 +0000 keopx 196 at https://keopx.net PHP 5.2 en Ubuntu Lucid (Downgrade) https://keopx.net/blog/php-52-en-ubuntu-lucid-downgrade <span>PHP 5.2 en Ubuntu Lucid (Downgrade)</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Tras la actualización a Ubuntu 10.04, nos ha traído algún que otra incompatibilidad en el código php de algunas aplicaciones, algunas de ellas relacionadas con Drupal. Vamos a ver como tener una versión anterior de php.</p> <pre> <code class="language-bash">#!/bin/sh # Script to install PHP 5.2 from 9.10 on 10.04 # And pin it so it does not get updated PKGS=`dpkg -l | grep php | awk '{print $2}'` apt-get remove $PKGS sed s/lucid/karmic/g /etc/apt/sources.list | tee /etc/apt/sources.list.d/karmic.list mkdir -p /etc/apt/preferences.d/ for PACKAGE in $PKGS do echo "Package: $PACKAGE Pin: release a=karmic Pin-Priority: 991 " | tee -a /etc/apt/preferences.d/php done apt-get update apt-get install $PKGS</code></pre><p>Hora ya tendremos los repositorios de karmic para la el php que contiene la version 5.2 Referencias:</p> <ul><li><a href="http://2bits.com/drupal-planet/various-ways-running-php-52-ubuntu-1004-lucid-lynx.html">http://2bits.com/drupal-planet/various-ways-running-php-52-ubuntu-1004-lucid-lynx.html</a></li> <li><a href="http://civicactions.com/blog/2010/may/26/ubuntu_1004_and_drupal">http://civicactions.com/blog/2010/may/26/ubuntu_1004_and_drupal</a></li> <li><a href="http://randyfay.com/node/63">http://randyfay.com/node/63</a></li> <li><a href="http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/">http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/</a></li> </ul></div> <span><span>keopx</span></span> <span><time datetime="2010-07-02T17:54:05+02:00" title="Viernes, Julio 2, 2010 - 17:54">Vie, 02/07/2010 - 17:54</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> <div class="field__item"><a href="/categoria/debian" hreflang="es">Debian</a></div> <div class="field__item"><a href="/categoria/ubuntu" hreflang="es">Ubuntu</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/php-53" hreflang="es">php 5.3</a></div> <div class="field__item"><a href="/tag/debian" hreflang="es">Debian</a></div> <div class="field__item"><a href="/tag/ubuntu" hreflang="es">Ubuntu</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=190&amp;2=field_comments&amp;3=comment" token="-RlDJZY-Ed1asPAuCt6me5QCDLHjHESA-4SIDMydOIM"></drupal-render-placeholder> </div> </div> </section> Fri, 02 Jul 2010 15:54:05 +0000 keopx 190 at https://keopx.net Instalacion de php 5.2.x en Debian Testing (squeeze) https://keopx.net/blog/instalacion-de-php-52x-en-debian-testing-squeeze <span>Instalacion de php 5.2.x en Debian Testing (squeeze)</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Para poder funcionar correctamente con Drupal 6.x es necesario el tener una versión anterior a la existente en el repositorio. En este caso es necesario la instalación de la versión de 5.2.x de php. Para ello es necesario desactualizar o eliminar todos los paquetes de php que tengamos. Creamos el siguiente script.</p> <pre lang="bash" line="1" xml:lang="bash"> sudo nano quitar_php.sh</pre><!--break--><pre lang="bash" line="1" xml:lang="bash"> php_installed=`dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` echo $php_installed sudo apt-get purge $php_installed</pre><p>Y ejecutamos.</p> <pre lang="bash" line="1" xml:lang="bash"> sudo sh quitar_php.sh</pre><p>Ahora procedemos a configurar las preferencias y repositorios para desacargar la nueva versión. <strong>/etc/apt/preferences.d/php</strong></p> <pre lang="bash" line="1" xml:lang="bash"> sudo nano /etc/apt/preferences.d/php</pre><p>Y pegamos:</p> <pre lang="bash" line="1" xml:lang="bash"> Package: php5 Pin: release a=lenny Pin-Priority: 991 Package: php5-exactimage Pin: release a=lenny Pin-Priority: 991 Package: php5-ffmpeg Pin: release a=lenny Pin-Priority: 991 Package: php5-gpib Pin: release a=lenny Pin-Priority: 991 Package: php5-lasso Pin: release a=lenny Pin-Priority: 991 Package: php5-mapscript Pin: release a=lenny Pin-Priority: 991 Package: php5-ming Pin: release a=lenny Pin-Priority: 991 Package: php5-uuid Pin: release a=lenny Pin-Priority: 991 Package: php5-adodb Pin: release a=lenny Pin-Priority: 991 Package: php5-auth-pam Pin: release a=lenny Pin-Priority: 991 Package: php5-clamav Pin: release a=lenny Pin-Priority: 991 Package: php5-geoip Pin: release a=lenny Pin-Priority: 991 Package: php5-idn Pin: release a=lenny Pin-Priority: 991 Package: php5-memcache Pin: release a=lenny Pin-Priority: 991 Package: php5-memcached Pin: release a=lenny Pin-Priority: 991 Package: php5-ps Pin: release a=lenny Pin-Priority: 991 Package: php5-radius Pin: release a=lenny Pin-Priority: 991 Package: php5-sasl Pin: release a=lenny Pin-Priority: 991 Package: php5-suhosin Pin: release a=lenny Pin-Priority: 991 Package: php5-svn Pin: release a=lenny Pin-Priority: 991 Package: php5-cgi Pin: release a=lenny Pin-Priority: 991 Package: php5-cli Pin: release a=lenny Pin-Priority: 991 Package: php5-curl Pin: release a=lenny Pin-Priority: 991 Package: php5-dbg Pin: release a=lenny Pin-Priority: 991 Package: php5-dev Pin: release a=lenny Pin-Priority: 991 Package: php5-enchant Pin: release a=lenny Pin-Priority: 991 Package: php5-gd Pin: release a=lenny Pin-Priority: 991 Package: php5-gmp Pin: release a=lenny Pin-Priority: 991 Package: php5-imap Pin: release a=lenny Pin-Priority: 991 Package: php5-interbase Pin: release a=lenny Pin-Priority: 991 Package: php5-intl Pin: release a=lenny Pin-Priority: 991 Package: php5-ldap Pin: release a=lenny Pin-Priority: 991 Package: php5-mcrypt Pin: release a=lenny Pin-Priority: 991 Package: php5-odbc Pin: release a=lenny Pin-Priority: 991 Package: php5-pgsql Pin: release a=lenny Pin-Priority: 991 Package: php5-pspell Pin: release a=lenny Pin-Priority: 991 Package: php5-recode Pin: release a=lenny Pin-Priority: 991 Package: php5-snmp Pin: release a=lenny Pin-Priority: 991 Package: php5-sqlite Pin: release a=lenny Pin-Priority: 991 Package: php5-sybase Pin: release a=lenny Pin-Priority: 991 Package: php5-tidy Pin: release a=lenny Pin-Priority: 991 Package: php5-xmlrpc Pin: release a=lenny Pin-Priority: 991 Package: php5-xsl Pin: release a=lenny Pin-Priority: 991 Package: php5-librdf Pin: release a=lenny Pin-Priority: 991 Package: php5-remctl Pin: release a=lenny Pin-Priority: 991 Package: php5-symfony1.0 Pin: release a=lenny Pin-Priority: 991 Package: php5-xapian Pin: release a=lenny Pin-Priority: 991 Package: php5-xcache Pin: release a=lenny Pin-Priority: 991 Package: php5-xdebug Pin: release a=lenny Pin-Priority: 991 Package: php5-common Pin: release a=lenny Pin-Priority: 991 Package: php5-mysql Pin: release a=lenny Pin-Priority: 991 Package: libapache2-mod-php5 Pin: release a=lenny Pin-Priority: 991 Package: libapache2-mod-php5filter Pin: release a=lenny Pin-Priority: 991 Package: php-pear Pin: release a=lenny Pin-Priority: 991</pre><p><strong>/etc/apt/sources.list</strong></p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/apt/sources.list</pre><pre lang="bash" line="1" xml:lang="bash"> # deb cdrom:[Debian GNU/Linux testing _testing_ - Official Snapshot i386 CD Binary-1 20100416-11:48]/ testing main #deb cdrom:[Debian GNU/Linux testing _testing_ - Official Snapshot i386 CD Binary-1 20100416-11:48]/ testing main deb http://ftp.de.debian.org/debian/ testing main non-free contrib deb-src http://ftp.de.debian.org/debian/ testing main non-free contrib deb http://security.debian.org/ testing/updates main contrib non-free deb-src http://security.debian.org/ testing/updates main contrib non-free ### Chromium deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main ### Opera deb http://deb.opera.com/opera testing non-free ### VirtualBox deb http://download.virtualbox.org/virtualbox/debian lenny non-free ### Multimedia deb http://www.debian-multimedia.org stable main contrib non-free #deb http://www.debian-multimedia.org testing main contrib non-free</pre><p><strong>/etc/apt/sources.list.d/lenny.list</strong></p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/apt/sources.list.d/lenny.list</pre><pre lang="bash" line="1" xml:lang="bash"> deb http://ftp.de.debian.org/debian/ lenny main non-free contrib deb-src http://ftp.de.debian.org/debian/ lenny main non-free contrib</pre><p><strong>/etc/apt/apt.conf</strong></p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/apt/apt.conf</pre><pre lang="bash" line="1" xml:lang="bash"> APT::Default-Release "testing"; APT::Cache-Limit 100000000; Apt::Get::Purge; APT::Clean-Installed; APT::Get::Fix-Broken; APT::Get::Fix-Missing; APT::Get::Show-Upgraded "true"; </pre><p>Ahora actualizamos e instalamos los paquetes.</p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo aptitude update</pre><pre lang="bash" line="1" xml:lang="bash"> $ sudo aptitude install -t lenny php5</pre><p>En este caso solo hemos instalado php5, pero podríamos instalar todos lo que necesitásemos. Nos mostrara un listado con las dependencias y deberemos ser cuidadosos a la hora de elegir que paquetes instalamos. Lo mismo sucederá cuando actualicemos el equipo.</p> </div> <span><span>keopx</span></span> <span><time datetime="2010-06-01T15:17:26+02:00" title="Martes, Junio 1, 2010 - 15:17">Mar, 01/06/2010 - 15:17</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> <div class="field__item"><a href="/categoria/sistemas" hreflang="es">Sistemas</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/sistemas" hreflang="es">Sistemas</a></div> <div class="field__item"><a href="/tag/php-53" hreflang="es">php 5.3</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=183&amp;2=field_comments&amp;3=comment" token="Gyam1J1DGHfJNpDFJFto-kWbSc3LSNuIucmZQA7tNbM"></drupal-render-placeholder> </div> </div> </section> Tue, 01 Jun 2010 13:17:26 +0000 keopx 183 at https://keopx.net Instalar APC y Memcache para Drupal https://keopx.net/blog/instalar-apc-y-memcache-para-drupal <span>Instalar APC y Memcache para Drupal</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><h1 id="APC">APC</h1> <p>Instalamos el paquete de apc para php5</p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo aptitude install php-apc</pre><h1 id="Memcache">Memcache</h1> <h2 id="Servidor-de-memcache">Servidor de memcache</h2> <pre lang="bash" xml:lang="bash"> $ sudo aptitude install memcached</pre><h2 id="Memcache-para-php5">Memcache para php5</h2> <p>El modulo por defecto del php5-memcache de fallos y parece que según el CVS para la siguiente versión va estar corregido. </p> <!--break--><p> Es necesario el compilarlo a pelo:</p> <pre lang="bash" line="1" xml:lang="bash"> $ wget http://pecl.php.net/get/memcache-2.2.5.tgz $ tar -zxvf memcached-2.2.5.tgz $ cd memcached-2.2.5 $ phpize &amp;&amp; ./configure --enable-memcache &amp;&amp; make $ sudo cp memcache.so /usr/lib/php5/20060613+lfs/ $ cd /etc/php5/apache2/conf.d/ $ sudo su $ echo 'extension=memcache.so' &gt; /etc/php.d/memcached.ini $ /etc/init.d/apache2 restart</pre><p>Ahora ya configuramos los parámetros.</p> <div id="change-2311"> <div id="journal-2311-notes"> <h1 id="phpini">php.ini</h1> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/php5/apache2/php.ini</pre><p>Y añadimos:</p> <pre lang="bash" line="1" xml:lang="bash"> ; Memcache memcache.hash_strategy="consistent"</pre><h1 id="settingsphp">settings.php</h1> <p>Configuración del cache para nuestro sitio. Esta sacado de <a href="http://www.lullabot.com/">lullabot</a>.</p> <pre lang="php" line="1" xml:lang="php"> <!--?php $conf = array( // The path to wherever memcache.inc is. The easiest is to simply point it // to the copy in your module's directory. //'cache_inc' =--> './sites/all/modules/memcache/memcache.inc', // or 'cache_inc' =&gt; './sites/all/modules/memcache/memcache.db.inc', 'memcache_servers' =&gt; array( 'localhost:11211' =&gt; 'default', 'localhost:11212' =&gt; 'content', 'localhost:11213' =&gt; 'filter', 'localhost:11214' =&gt; 'menu', 'localhost:11215' =&gt; 'page', 'localhost:11216' =&gt; 'views', ), 'memcache_bins' =&gt; array( 'cache' =&gt; 'default', 'cache_content' =&gt; 'content', 'cache_filter' =&gt; 'filter', 'cache_menu' =&gt; 'menu', 'cache_page' =&gt; 'page', 'cache_views' =&gt; 'views', ), ); ?&gt;</pre><h1 id="Servidor-de-memcache">Servidor de memcache</h1> <p>Editamos el fichero de memcache y lo configuramos con los siguientes parámetros personalizados.</p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/init.d/memcache</pre><p>Estos parámetros variaran según el hardware y aplicación.</p> <pre lang="bash" line="1" xml:lang="bash"> #!/bin/bash prog="memcached" start() { echo -n $"Starting $prog " # Sessions cache. memcached -m 16 -l 0.0.0.0 -p 11211 -d -u nobody # Default cache. memcached -m 32 -l 0.0.0.0 -p 11212 -d -u nobody # Block cache. memcached -m 32 -l 0.0.0.0 -p 11213 -d -u nobody # Content cache. Holds fully loaded content type structures. memcached -m 16 -l 0.0.0.0 -p 11214 -d -u nobody # Filter cache. Usually the busiest cache after the default. memcached -m 32 -l 0.0.0.0 -p 11215 -d -u nobody # Form cache. memcached -m 32 -l 0.0.0.0 -p 11216 -d -u nobody # Menu cache. memcached -m 32 -l 0.0.0.0 -p 11217 -d -u nobody # Page cache. Bigger than most other caches. memcached -m 128 -l 0.0.0.0 -p 11218 -d -u nobody # Views definition cache. memcached -m 1 -l 0.0.0.0 -p 11219 -d -u nobody # Views data cache (may need to be increased if heavily used). memcached -m 32 -l 0.0.0.0 -p 11220 -d -u nobody # More caches that might be added later: # Users table. #/usr/bin/memcached -m 24 -l 0.0.0.0 -p 11219 -d -u nobody # Path source cache. #/usr/bin/memcached -m 4 -l 0.0.0.0 -p 11220 -d -u nobody # Path destination cache. #/usr/bin/memcached -m 6 -l 0.0.0.0 -p 11221 -d -u nobody RETVAL=$? echo return $RETVAL } stop() { if test "x`pidof memcached`" != x; then echo -n $"Stopping $prog " killall memcached echo fi RETVAL=$? return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if test "x`pidof memcached`" != x; then stop start fi ;; *) echo $"Usage: $0 {start|stop|restart|condrestart}" exit 1 esac exit $RETVAL</pre><h1 id="Referencias">Referencias</h1> <ul><li><a href="http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment">http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment</a></li> <li><a href="http://www.lullabot.com/articles/how_install_memcache_debian_etch">http://www.lullabot.com/articles/how_install_memcache_debian_etch</a></li> <li><a href="http://drupal.org/project/memcache">http://drupal.org/project/memcache</a></li> <li><a href="http://www.lullabot.com/articles/a_beginners_guide_to_caching_data">http://www.lullabot.com/articles/a_beginners_guide_to_caching_data</a></li> <li><a href="http://www.howtoforge.com/installing-memcached-and-the-php5-memcache-module-on-debian-etch-apache2">http://www.howtoforge.com/installing-memcached-and-the-php5-memcache-module-on-debian-etch-apache2</a></li> <li><a href="http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/">http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/</a></li> <li><a href="http://de.php.net/manual/en/memcache.installation.php#95063">http://de.php.net/manual/en/memcache.installation.php#95063</a></li> <li><a href="http://blogofsysadmins.com/instalar-memcached-en-centos-5-3">http://blogofsysadmins.com/instalar-memcached-en-centos-5-3</a></li> </ul></div> </div> </div> <span><span>keopx</span></span> <span><time datetime="2010-04-29T12:23:50+02:00" title="Jueves, Abril 29, 2010 - 12:23">Jue, 29/04/2010 - 12:23</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> <div class="field__item"><a href="/categoria/gnu-linux" hreflang="es">GNU Linux</a></div> <div class="field__item"><a href="/categoria/drupal" hreflang="es">Drupal</a></div> <div class="field__item"><a href="/categoria/drupal-planeta" hreflang="es">Drupal Planeta</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/rendimiento" hreflang="es">Rendimiento</a></div> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/memcache" hreflang="es">memcache</a></div> <div class="field__item"><a href="/tag/cache" hreflang="es">cache</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=181&amp;2=field_comments&amp;3=comment" token="mjBtBpEleUb_ZMgTFheheRElvUgBOSg-e1vlPY3ZG74"></drupal-render-placeholder> </div> </div> </section> Thu, 29 Apr 2010 10:23:50 +0000 keopx 181 at https://keopx.net Instalar extensión PECL uploadprogress https://keopx.net/blog/instalar-extension-pecl-uploadprogress <span>Instalar extensión PECL uploadprogress</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item quickedit-field" data-quickedit-field-id="node/169/body/es/full"> <p>Para ver la barra de progreso de subida de ficheros es necesario instalar una extensión para PHP.</p> <p>Descargar <a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress extensión</a></p> <p>Extraer el fichero <em>uploadprogress-1.x.x.tgz</em>:</p> <pre> <code class="language-bash">$ tar xvzf uploadprogress-1.x.x.tgz</code></pre><p>Instalamos php5-dev para poder utilziar <em>phpize</em></p> <pre> <code class="language-bash">sudo aptitude install php5-dev</code></pre><p>Y ejecutamos:</p> <pre> <code class="language-bash">$ phpize $ ./configure $ make $ sudo make install</code></pre><p>Comprobamos que el directorio de la extensión es correcta. La ultima linea de la salida del comando <em>$ make install</em> es:</p> <pre> <code class="language-bash">Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/</code></pre><p>Abrir el fichero <em>php.ini</em> y añadir la extensión.</p> <p>Reemplazar la ruta <em>extension_dir</em> con el path anterior.</p> <p>Añadir la extension</p> <pre> <code class="language-bash">extension=uploadprogress.so</code></pre><p>Reiniciar apache.</p> <p><em>You should now have the PECL uploadprogress extension installed.</em></p> </div> </div> <span><span>keopx</span></span> <span><time datetime="2010-03-09T11:06:39+01:00" title="Martes, Marzo 9, 2010 - 11:06">Mar, 09/03/2010 - 11:06</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/sistemas" hreflang="es">Sistemas</a></div> <div class="field__item"><a href="/categoria/gnu-linux" hreflang="es">GNU Linux</a></div> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/sistemas" hreflang="es">Sistemas</a></div> <div class="field__item"><a href="/tag/gnu-linux" hreflang="es">GNU Linux</a></div> <div class="field__item"><a href="/tag/apache" hreflang="es">apache</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=169&amp;2=field_comments&amp;3=comment" token="fHjsYCZcA_Hk_oJYjM4jijoC_DVyijV2W1hODOnaVUo"></drupal-render-placeholder> </div> </div> </section> Tue, 09 Mar 2010 10:06:39 +0000 keopx 169 at https://keopx.net NetBeans php y xdebug https://keopx.net/blog/netbeans-php-y-xdebug <span>NetBeans php y xdebug</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Con el nuevo desarrollo de módulos de Drupal para poder debugear he necesitado configurar varias herramientas.</p> <ul><li><a href="http://bits.netbeans.org/netbeans/6.8/community/fcs/bundles/netbeans-6.8-ml-linux.sh">NetBeans 6.8</a> soporte php</li> <li><a href="http://drupal.org/">Drupal</a></li> <li><a href="http://www.xdebug.org/">Xdebug</a></li> <li><a href="https://nbdrupalsupport.dev.java.net/files/documents/8560/115265/org-netbeans-modules-php-drupal-module.nbm">nbdrupalsupport</a></li> </ul><p>Para ellos instalamos el paquete de los repositorios de xdebug para php:</p> <pre> <code class="language-bash">sudo aptitude install php5-xdebug</code></pre><p>Una vez realizado esto configuramos nuestro php.ini</p> <p>En mi caso: <code> </code></p> <pre> <code class="language-bash">sudo nano /etc/php5/apache2/php.ini</code></pre><p>Y añadimos al principio:</p> <pre> <code class="language-ini">[PHP] zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so [debug] ; Remote settings xdebug.remote_autostart=off xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=localhost xdebug.remote_port=9000 ; General xdebug.auto_trace=off xdebug.collect_includes=on xdebug.collect_params=off xdebug.collect_return=off xdebug.default_enable=on xdebug.extended_info=1 xdebug.manual_url=http://www.php.net xdebug.show_local_vars=0 xdebug.show_mem_delta=0 xdebug.max_nesting_level=100 ;xdebug.idekey= ; Trace options xdebug.trace_format=0 xdebug.trace_output_dir=/tmp xdebug.trace_options=0 xdebug.trace_output_name=crc32 ; Profiling xdebug.profiler_append=0 xdebug.profiler_enable=0 xdebug.profiler_enable_trigger=0 xdebug.profiler_output_dir=/tmp xdebug.profiler_output_name=crc32</code></pre><p> </p> </div> <span><span>keopx</span></span> <span><time datetime="2008-12-26T13:42:04+01:00" title="Viernes, Diciembre 26, 2008 - 13:42">Vie, 26/12/2008 - 13:42</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/xdebug" hreflang="es">Xdebug</a></div> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/netbeans" hreflang="es">Netbeans</a></div> <div class="field__item"><a href="/tag/php-53" hreflang="es">php 5.3</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=54&amp;2=field_comments&amp;3=comment" token="mgwrng5-mVw3TK8g81XeXIKqkH4oEJba5Qxus511gEk"></drupal-render-placeholder> </div> </div> </section> Fri, 26 Dec 2008 12:42:04 +0000 keopx 54 at https://keopx.net