<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zelofan &#187; php</title>
	<atom:link href="http://www.zelofan.net/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zelofan.net/blog</link>
	<description>Stories, music, flyers &#038; tech</description>
	<lastBuildDate>Tue, 17 Jan 2012 12:40:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Instalar apache+php+mysql+mod_wsgi en Snow Leopard</title>
		<link>http://www.zelofan.net/blog/2011/01/04/instalar-apachephpmysqlmod_wsgi-en-snow-leopard/</link>
		<comments>http://www.zelofan.net/blog/2011/01/04/instalar-apachephpmysqlmod_wsgi-en-snow-leopard/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 20:02:37 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mod_wsgi]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=1761</guid>
		<description><![CDATA[Últimamente, por diferentes circunstancias, he tenido que probar cosas nuevas en Apache. Hasta ahora, siempre había utilizado MAMP por su sencillez para ser instalado en Snow Leopard, pero una vez que necesitas nuevos módulos, versiones diferentes de los paquetes, etc&#8230; la cosa se complica bastante. Así que me decidí por utilizar MacPorts para configurar un [...]]]></description>
			<content:encoded><![CDATA[<div class="jLanguage">
<ul>
<li><a href="?lan=english"><img alt="english" src="http://www.zelofan.net/blog/wp-content/plugins/jLanguage/icons/en.png" /></a></li>
<li><a href="?lan=spanish"><img alt="spanish" src="http://www.zelofan.net/blog/wp-content/plugins/jLanguage/icons/es.png" /></a></li>
</ul>
</div>
<p>Últimamente, por diferentes circunstancias, he tenido que probar cosas nuevas en Apache. Hasta ahora, siempre había utilizado <a href="http://www.mamp.info/en/index.html">MAMP</a> por su sencillez para ser instalado en Snow Leopard, pero una vez que necesitas nuevos módulos, versiones diferentes de los paquetes, etc&#8230; la cosa se complica bastante. Así que me decidí por utilizar <a href="http://www.macports.org">MacPorts</a> para configurar un entorno de desarrollo local a medida. </p>
<h2>Instalación de XCode Developer Tools y MacPorts.<br />
</h2>
<p>En el dvd de Snow Leopard disponemos de <a href="http://developer.apple.com/technologies/tools/xcode.html">XCode Developer Tools</a>. Lo instalamos, asegurándonos de instalar las utilidades de desarrollo desde la línea de comandos (Unix Development).</p>
<p>A continuación, descargamos <a href="http://www.macports.org/">macports</a> (en este momento, versión 1.9.2). Instalamos como cualquier otra aplicación en Snow Leopard y nos aseguramos de tener todo actualizado a la última versión, abriendo un terminal y ejecutando<br />
<div id="wpshdo_21" class="wp-synhighlighter-outer"><div id="wpshdt_21" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_21"></a><a id="wpshat_21" class="wp-synhighlighter-title" href="#codesyntax_21"  onClick="javascript:wpsh_toggleBlock(21)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_21" onClick="javascript:wpsh_code(21)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_21" onClick="javascript:wpsh_print(21)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_21" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> port <span class="re5">-v</span> selfupdate</pre></div></div></p>
<h2>Instalación de  MySQL<br />
</h2>
<p>Comenzamos a utilizar macports, muy parecido a apt-get de debian, para instalar el servidor de MySQL (v5.1):<br />
<div id="wpshdo_22" class="wp-synhighlighter-outer"><div id="wpshdt_22" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_22"></a><a id="wpshat_22" class="wp-synhighlighter-title" href="#codesyntax_22"  onClick="javascript:wpsh_toggleBlock(22)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_22" onClick="javascript:wpsh_code(22)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_22" onClick="javascript:wpsh_print(22)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_22" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> port <span class="kw2">install</span> mysql5-server
<span class="kw2">sudo</span> <span class="re5">-u</span> mysql mysql_install_db5</pre></div></div></p>
<p>Hay varias formas de poner en marcha el demonio de mysql. Como no me gusta tener más demonios de la cuenta en el arranque del sistema, lo voy a poner en marcha manualmente cada vez que quiera utilizarlo. Una de las formas de ponerlo en marcha (más adelante crearemos un alias para no tener que escribir toda la ruta):<br />
<div id="wpshdo_23" class="wp-synhighlighter-outer"><div id="wpshdt_23" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_23"></a><a id="wpshat_23" class="wp-synhighlighter-title" href="#codesyntax_23"  onClick="javascript:wpsh_toggleBlock(23)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_23" onClick="javascript:wpsh_code(23)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_23" onClick="javascript:wpsh_print(23)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_23" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> <span class="sy0">/</span>opt<span class="sy0">/</span>local<span class="sy0">/</span>etc<span class="sy0">/</span>LaunchDaemons<span class="sy0">/</span>org.macports.mysql5<span class="sy0">/</span>mysql5.wrapper start</pre></div></div></p>
<p>Ahora, si vamos a trabajar en local, creamos la contraseña de root de mysql con<br />
<div id="wpshdo_24" class="wp-synhighlighter-outer"><div id="wpshdt_24" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_24"></a><a id="wpshat_24" class="wp-synhighlighter-title" href="#codesyntax_24"  onClick="javascript:wpsh_toggleBlock(24)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_24" onClick="javascript:wpsh_code(24)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_24" onClick="javascript:wpsh_print(24)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_24" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="sy0">/</span>opt<span class="sy0">/</span>local<span class="sy0">/</span>lib<span class="sy0">/</span>mysql5<span class="sy0">/</span>bin<span class="sy0">/</span>mysqladmin <span class="re5">-u</span> root password <span class="st_h">'password'</span></pre></div></div></p>
<p>(Para entornos de producción, además de cambiar el password, habría que cambiar más cosas, como deshabilitar el acceso anónimo y el acceso remoto de root, con /opt/local/lib/mysql5/bin/mysql_secure_installation)</p>
<h2>Instalación de Apache</h2>
<p>Para instalar apache, volvemos a hacer uso de macports y, como he estado jugando con python/django, instalo también el módulo mod_wsgi (una de las cosas &#8220;complicadas&#8221; con MAMP):<br />
<div id="wpshdo_25" class="wp-synhighlighter-outer"><div id="wpshdt_25" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_25"></a><a id="wpshat_25" class="wp-synhighlighter-title" href="#codesyntax_25"  onClick="javascript:wpsh_toggleBlock(25)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_25" onClick="javascript:wpsh_code(25)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_25" onClick="javascript:wpsh_print(25)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_25" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> port <span class="kw2">install</span> apache2 mod_wsgi</pre></div></div></p>
<p>A continuación, editamos el archivo de configuración de apache /opt/local/apache2/conf/httpd.conf para añadir el módulo de wsgi y, ya que estamos, cambiar el nombre del servidor:<br />
<div id="wpshdo_26" class="wp-synhighlighter-outer"><div id="wpshdt_26" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_26"></a><a id="wpshat_26" class="wp-synhighlighter-title" href="#codesyntax_26"  onClick="javascript:wpsh_toggleBlock(26)" title="Click to show/hide code block">/opt/local/apache2/conf/httpd.conf</a></td><td align="right"><a href="#codesyntax_26" onClick="javascript:wpsh_code(26)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_26" onClick="javascript:wpsh_print(26)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_26" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;"><span class="kw1">LoadModule</span> wsgi_module modules/mod_wsgi.so
<span class="kw1">ServerName</span> localhost</pre></div></div></p>
<h2>Instalación de PHP</h2>
<p>Ahora instalamos php5, con los módulos para apache2 y mysql5.<br />
<div id="wpshdo_27" class="wp-synhighlighter-outer"><div id="wpshdt_27" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_27"></a><a id="wpshat_27" class="wp-synhighlighter-title" href="#codesyntax_27"  onClick="javascript:wpsh_toggleBlock(27)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_27" onClick="javascript:wpsh_code(27)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_27" onClick="javascript:wpsh_print(27)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_27" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> port <span class="kw2">install</span> php5 +apache2 php5-mysql</pre></div></div><br />
Activamos el módulo de php en apache con<br />
<div id="wpshdo_28" class="wp-synhighlighter-outer"><div id="wpshdt_28" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_28"></a><a id="wpshat_28" class="wp-synhighlighter-title" href="#codesyntax_28"  onClick="javascript:wpsh_toggleBlock(28)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_28" onClick="javascript:wpsh_code(28)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_28" onClick="javascript:wpsh_print(28)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_28" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw3">cd</span> <span class="sy0">/</span>opt<span class="sy0">/</span>local<span class="sy0">/</span>apache2<span class="sy0">/</span>modules
<span class="kw2">sudo</span> <span class="sy0">/</span>opt<span class="sy0">/</span>local<span class="sy0">/</span>apache2<span class="sy0">/</span>bin<span class="sy0">/</span>apxs <span class="re5">-a</span> <span class="re5">-e</span> <span class="re5">-n</span> <span class="st0">&quot;php5&quot;</span> libphp5.so</pre></div></div><br />
y editamos de nuevo /opt/local/apache2/conf/httpd.conf para añadir en la sección de mime types a los ficheros .php:<br />
<div id="wpshdo_29" class="wp-synhighlighter-outer"><div id="wpshdt_29" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_29"></a><a id="wpshat_29" class="wp-synhighlighter-title" href="#codesyntax_29"  onClick="javascript:wpsh_toggleBlock(29)" title="Click to show/hide code block">/opt/local/apache2/conf/httpd.conf</a></td><td align="right"><a href="#codesyntax_29" onClick="javascript:wpsh_code(29)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_29" onClick="javascript:wpsh_print(29)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_29" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;"><span class="kw1">AddType</span> application/x-httpd-php .php</pre></div></div></p>
<p>Como archivo de configuración de php, tenemos dos archivos php.ini de ejemplo en /opt/local/etc/php5. Como estamos en desarrollo, utizamos el php.ini-development para tener nuestro php.ini<br />
<div id="wpshdo_30" class="wp-synhighlighter-outer"><div id="wpshdt_30" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_30"></a><a id="wpshat_30" class="wp-synhighlighter-title" href="#codesyntax_30"  onClick="javascript:wpsh_toggleBlock(30)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_30" onClick="javascript:wpsh_code(30)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_30" onClick="javascript:wpsh_print(30)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_30" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> <span class="kw2">cp</span> php.ini-development php.ini</pre></div></div><br />
Por último, editamos /opt/local/etc/php5/php.ini y cambiamos date.timezone a nuestra zona y el socket de mysql:<br />
<div id="wpshdo_31" class="wp-synhighlighter-outer"><div id="wpshdt_31" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_31"></a><a id="wpshat_31" class="wp-synhighlighter-title" href="#codesyntax_31"  onClick="javascript:wpsh_toggleBlock(31)" title="Click to show/hide code block">/opt/local/etc/php5/php.ini</a></td><td align="right"><a href="#codesyntax_31" onClick="javascript:wpsh_code(31)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_31" onClick="javascript:wpsh_print(31)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_31" class="wp-synhighlighter-inner" style="display: block;"><pre class="ini" style="font-family:monospace;">date.timezone<span class="sy0">=</span><span class="re2">Europe/Madrid</span>
mysql.default_socket <span class="sy0">=</span><span class="re2"> /opt/local/var/run/mysql5/mysqld.sock</span></pre></div></div></p>
<h2>Arranque y parada de Apache y MySQL</h2>
<p>Ya sólo nos queda crear un alias para llamar y ejecutar apache y mysql cuando queramos en nuestro .profile<br />
<div id="wpshdo_32" class="wp-synhighlighter-outer"><div id="wpshdt_32" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_32"></a><a id="wpshat_32" class="wp-synhighlighter-title" href="#codesyntax_32"  onClick="javascript:wpsh_toggleBlock(32)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_32" onClick="javascript:wpsh_code(32)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_32" onClick="javascript:wpsh_print(32)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_32" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw3">cd</span> ~
<span class="kw2">nano</span> .profile</pre></div></div><br />
<div id="wpshdo_33" class="wp-synhighlighter-outer"><div id="wpshdt_33" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_33"></a><a id="wpshat_33" class="wp-synhighlighter-title" href="#codesyntax_33"  onClick="javascript:wpsh_toggleBlock(33)" title="Click to show/hide code block">~/.profile</a></td><td align="right"><a href="#codesyntax_33" onClick="javascript:wpsh_code(33)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_33" onClick="javascript:wpsh_print(33)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_33" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw3">alias</span> <span class="re2">apache2</span>=<span class="st_h">'sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper'</span>
<span class="kw3">alias</span> <span class="re2">mysql5</span>=<span class="st_h">'sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper'</span>
<span class="kw3">alias</span> <span class="re2">mysql</span>=<span class="st_h">'/opt/local/bin/mysql5'</span></pre></div></div></p>
<p>De esta forma, con &#8220;apache2 start|stop|restart&#8221; y &#8220;mysql5 start|stop|restart&#8221; tenemos bajo control los demonios respectivos, y creamos un alias al cliente de mysql, por si queremos utilizarlo sin realizar la llamada con la ruta absoluta.</p>
<h2>Configuración de hosts en Apache</h2>
<p>Por defecto, Apache lee los documentos de /opt/local/apache2/htdocs. Esto lo podemos cambiar para adecuarlo a nuestras necesidades. Por ejemplo, a mí me gusta tener todas las webs en desarrollo dentro del directorio Sites de mi usuario. Para ello, editamos /opt/local/apache2/conf/httdp.conf y cambiamos el DocumentRoot de &#8220;/opt/local/apache2/htdocs&#8221; a &#8220;/Users/my_user/Sites&#8221; y la directiva Directory &#8220;/opt/local/apache2/htdocs&#8221; de la misma forma:</p>
<div id="wpshdo_34" class="wp-synhighlighter-outer"><div id="wpshdt_34" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_34"></a><a id="wpshat_34" class="wp-synhighlighter-title" href="#codesyntax_34"  onClick="javascript:wpsh_toggleBlock(34)" title="Click to show/hide code block">/opt/local/apache2/conf/httpd.conf</a></td><td align="right"><a href="#codesyntax_34" onClick="javascript:wpsh_code(34)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_34" onClick="javascript:wpsh_print(34)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_34" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;"><span class="kw1">DocumentRoot</span> <span class="st0">&quot;/Users/my_user/Sites&quot;</span>
...
&lt;<span class="kw3">Directory</span> <span class="st0">&quot;/Users/my_user/Sites&quot;</span>&gt;
...</pre></div></div>
<p>Además, normalmente tengo varias webs en desarrollo, así que vamos a utilizar hosts virtuales. Para ello, descomentamos la línea del httpd.conf:<br />
<div id="wpshdo_35" class="wp-synhighlighter-outer"><div id="wpshdt_35" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_35"></a><a id="wpshat_35" class="wp-synhighlighter-title" href="#codesyntax_35"  onClick="javascript:wpsh_toggleBlock(35)" title="Click to show/hide code block">/opt/local/apache2/conf/httpd.conf</a></td><td align="right"><a href="#codesyntax_35" onClick="javascript:wpsh_code(35)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_35" onClick="javascript:wpsh_print(35)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_35" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;"><span class="kw1">Include</span> conf/extra/httpd-vhosts.conf</pre></div></div></p>
<p>y en httpd-vhosts.conf, siguiendo el ejemplo de los que hay creados (y que debemos comentar, si no queremos errores al arrancar apache), creamos todos los hosts virtuales que necesitemos:<br />
<div id="wpshdo_36" class="wp-synhighlighter-outer"><div id="wpshdt_36" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_36"></a><a id="wpshat_36" class="wp-synhighlighter-title" href="#codesyntax_36"  onClick="javascript:wpsh_toggleBlock(36)" title="Click to show/hide code block">/opt/local/apache2/conf/extras/httpd-vhosts.conf</a></td><td align="right"><a href="#codesyntax_36" onClick="javascript:wpsh_code(36)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_36" onClick="javascript:wpsh_print(36)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_36" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;">&lt;<span class="kw3">VirtualHost</span> *:80&gt;
    <span class="kw1">DocumentRoot</span> <span class="st0">&quot;/Users/my_user/Sites/web1&quot;</span>
    <span class="kw1">ServerName</span> dominio1.localhost
    <span class="kw1">ErrorLog</span> <span class="st0">&quot;logs/error_log&quot;</span>
    <span class="kw1">CustomLog</span> <span class="st0">&quot;logs/access_log&quot;</span> common
&lt;/<span class="kw3">VirtualHost</span>&gt;
&lt;<span class="kw3">VirtualHost</span> *:80&gt;
    <span class="kw1">DocumentRoot</span> <span class="st0">&quot;/Users/my_user/Sites/web2&quot;</span>
    <span class="kw1">ServerName</span> dominio2.localhost
    <span class="kw1">ErrorLog</span> <span class="st0">&quot;logs/error_log&quot;</span>
    <span class="kw1">CustomLog</span> <span class="st0">&quot;logs/access_log&quot;</span> common
&lt;/<span class="kw3">VirtualHost</span>&gt;</pre></div></div></p>
<p>Recuerda añadir los dominios de estos hosts virtuales en /etc/hosts:<br />
<div id="wpshdo_37" class="wp-synhighlighter-outer"><div id="wpshdt_37" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_37"></a><a id="wpshat_37" class="wp-synhighlighter-title" href="#codesyntax_37"  onClick="javascript:wpsh_toggleBlock(37)" title="Click to show/hide code block">/etc/hosts</a></td><td align="right"><a href="#codesyntax_37" onClick="javascript:wpsh_code(37)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_37" onClick="javascript:wpsh_print(37)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_37" class="wp-synhighlighter-inner" style="display: block;"><pre class="text" style="font-family:monospace;">127.0.0.1 localhost
127.0.0.1 dominio1.localhost
127.0.0.1 dominio2.localhost
...</pre></div></div></p>
<h2>Instalación de phpmyadmin</h2>
<p>Como es algo que solemos utilizar muchas veces, instalamos phpmyadmin mediante macports:</p>
<div id="wpshdo_38" class="wp-synhighlighter-outer"><div id="wpshdt_38" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_38"></a><a id="wpshat_38" class="wp-synhighlighter-title" href="#codesyntax_38"  onClick="javascript:wpsh_toggleBlock(38)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_38" onClick="javascript:wpsh_code(38)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_38" onClick="javascript:wpsh_print(38)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_38" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> port <span class="kw2">install</span> phpmyadmin</pre></div></div>
<p>Sólo nos queda configurar un host virtual para acceder a él:<br />
<div id="wpshdo_39" class="wp-synhighlighter-outer"><div id="wpshdt_39" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_39"></a><a id="wpshat_39" class="wp-synhighlighter-title" href="#codesyntax_39"  onClick="javascript:wpsh_toggleBlock(39)" title="Click to show/hide code block">/opt/local/apache5/conf/extra/httpd-vhosts.conf</a></td><td align="right"><a href="#codesyntax_39" onClick="javascript:wpsh_code(39)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_39" onClick="javascript:wpsh_print(39)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_39" class="wp-synhighlighter-inner" style="display: block;"><pre class="apache" style="font-family:monospace;">&lt;<span class="kw3">VirtualHost</span> *:80&gt;
    <span class="kw1">DocumentRoot</span> <span class="st0">&quot;/opt/local/www/phpmyadmin&quot;</span>
    <span class="kw1">ServerName</span> phpmyadmin.localhost
	&lt;<span class="kw3">Directory</span> <span class="st0">&quot;/opt/local/www/phpmyadmin&quot;</span>&gt;
		<span class="kw1">Options</span> <span class="kw2">Indexes</span> <span class="kw2">FollowSymLinks</span>
		<span class="kw1">AllowOverride</span> <span class="kw2">None</span>
		<span class="kw1">Order</span> <span class="kw1">allow</span>,<span class="kw1">deny</span>
		<span class="kw1">Allow</span> from <span class="kw2">all</span>
	&lt;/<span class="kw3">Directory</span>&gt;
&lt;/<span class="kw3">VirtualHost</span>&gt;</pre></div></div><br />
añadiendo de nuevo la referencia en nuestro archivo de hosts:<br />
<div id="wpshdo_40" class="wp-synhighlighter-outer"><div id="wpshdt_40" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_40"></a><a id="wpshat_40" class="wp-synhighlighter-title" href="#codesyntax_40"  onClick="javascript:wpsh_toggleBlock(40)" title="Click to show/hide code block">/etc/hosts</a></td><td align="right"><a href="#codesyntax_40" onClick="javascript:wpsh_code(40)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_40" onClick="javascript:wpsh_print(40)" title="Print code"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.zelofan.net/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_40" class="wp-synhighlighter-inner" style="display: block;"><pre class="text" style="font-family:monospace;">...
127.0.0.1 phpmyadmin.localhost</pre></div></div></p>
<p>Con esto ya está todo. Tenemos un entorno de desarrollo a medida, podemos cambiar, añadir, quitar los módulos que queremos a nuestro antojo, y todo de manera sencilla gracias a macports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2011/01/04/instalar-apachephpmysqlmod_wsgi-en-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony: dos campos con TinyMCE en el mismo formulario</title>
		<link>http://www.zelofan.net/blog/2009/03/24/symfony-dos-campos-con-tinymce-en-el-mismo-formulario/</link>
		<comments>http://www.zelofan.net/blog/2009/03/24/symfony-dos-campos-con-tinymce-en-el-mismo-formulario/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 18:21:26 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=1087</guid>
		<description><![CDATA[En symfony podemos utilizar fácilmente TinyMCE en un textarea gracias al plugin sfFormExtraPlugin. Una vez instalado el plugin con symfony plugin:install sfFormExtraPlugin debemos recordar bajar también el paquete de TinyMCE y descomprimirlo en web/js. En mi caso, lo he dejado en web/js/tiny_mce, por lo que, a continuación, he modificado el archivo view.yml de mi aplicación, [...]]]></description>
			<content:encoded><![CDATA[<p>En <a href="http://www.symfony-project.org">symfony</a> podemos utilizar fácilmente <a href="http://tinymce.moxiecode.com/">TinyMCE</a> en un textarea gracias al plugin <a href="http://www.symfony-project.org/plugins/sfFormExtraPlugin">sfFormExtraPlugin</a>. Una vez instalado el plugin con </p>
<p><code>symfony plugin:install sfFormExtraPlugin</code></p>
<p> debemos recordar bajar también el <a href="http://tinymce.moxiecode.com/download.php">paquete de TinyMCE</a> y  descomprimirlo en web/js. En mi caso, lo he dejado en web/js/tiny_mce, por lo que, a continuación, he modificado el archivo view.yml de mi aplicación, específicamente la línea</p>
<p><code> javascript: [ tiny_mce/tiny_mce.js ]</code></p>
<p>para cargar TinyMCE en todas mis páginas. Si no quisiera cargarlo en todas, modificaríamos el view.yml del módulo en particular donde lo queremos utilizar. Debemos recordar, así mismo, modificar el settings.yml de nuestra aplicación para indicar dónde se encuentra:</p>
<p><code>rich_text_js_dir: js/tiny_mce</code></p>
<p>Para utilizar el textarea con TinyMCE, sólo debemos declarar el widget correspondiente de la siguiente forma:</p>
<p><code>$this->widgetSchema['entradilla']  = new sfWidgetFormTextareaTinyMCE(<br />
            array(<br />
            'config' => sfConfig::get('app_tiny_mce_simple')<br />
            ));</code></p>
<p>Lo que he hecho, en este caso, es llamar a sfWidgetFormTextareaTinyMCE con la configuración almacenada en el app.yml de nuestra aplicación, donde me he definido la variable global app_tiny_mce_simple, que contiene lo siguiente:</p>
<p><code>  tiny_mce_simple: |<br />
    width: "550px",<br />
    height: "200px",<br />
    language: "es",<br />
    relative_urls: false,<br />
    convert_urls: false,<br />
    plugins: "preview, paste, advlink, fullscreen",<br />
    theme_advanced_buttons1: "bold, italic, underline, separator, justifyleft, justifycenter, justifyright, justifyfull, separator, outdent, indent, separator, pastetext, pasteword, separator, link, bullist, numlist, separator, undo, redo, selectall, separator, preview, code, fullscreen",<br />
    theme_advanced_buttons2: "",<br />
    theme_advanced_buttons3: "",<br />
    plugin_preview_width: "500",<br />
    plugin_preview_height: "600",<br />
    fullscreen_new_window: true,<br />
    theme_advanced_resize_horizontal: false,<br />
    paste_auto_cleanup_on_paste: true,</code></p>
<p>Como véis, lo único que hemos hecho ha sido pasar los parámetros de configuración a TinyMCE.</p>
<p>El problema viene cuando queremos utilizar dos textareas con TinyMCE en el mismo formulario. De momento, en la versión 1.2.4 de Symfony, hay un pequeño &#8220;bug&#8221; (si podemos llegar a  llamarlo así), ya que al usar dos TinyMCE se pierden los ids. La solución es muy sencilla: añadir a la configuración de TinyMCE los parámetros elements con el id y mode con &#8220;exact&#8221;, como en este ejemplo:</p>
<p><code>$this->widgetSchema['entradilla']  = new sfWidgetFormTextareaTinyMCE(<br />
            array(<br />
            'config' => sfConfig::get('app_tiny_mce_simple'). ' elements: "noticia_entradilla", mode: "exact"'<br />
            ));</code></p>
<p>Ya podemos utilizar todos los textareas que queramos con TinyMCE, sólo tenemos que recordar cambiar &#8220;elements&#8221; por el id correspondiente.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2009/03/24/symfony-dos-campos-con-tinymce-en-el-mismo-formulario/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Configurar lighttpd para albergar un proyecto con symfony</title>
		<link>http://www.zelofan.net/blog/2008/12/02/configurar-lighttpd-para-albergar-un-proyecto-con-symfony/</link>
		<comments>http://www.zelofan.net/blog/2008/12/02/configurar-lighttpd-para-albergar-un-proyecto-con-symfony/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:27:05 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=733</guid>
		<description><![CDATA[Desde hace un par de meses tengo un pequeño servidor en casa con debian instalado, dedicado básicamente a estar las 24h conectado a internet bajando torrents y como servidor en el que hacer pruebas diversas. Al tener un hardware muy básico (128MB de RAM, procesador ARM9 de 500Mhz), el servidor web debía ser lo más [...]]]></description>
			<content:encoded><![CDATA[<p>Desde hace un par de meses tengo un pequeño servidor en casa con debian instalado, dedicado básicamente a estar las 24h conectado a internet bajando torrents y como servidor en el que hacer pruebas diversas. Al tener un hardware muy básico (128MB de RAM, procesador ARM9 de 500Mhz), el servidor web debía ser lo más ligero posible, por lo que todo el mundo recomendaba lighttpd. Así que me puse manos a la obra, y gracias a apt-get en un momento estaba instalado ;)</p>
<p>El problema vino hace un par de días al querer utilizar este servidor para realizar pruebas con symfony. En casi todos los sitios hablan de qué cambiar en apache, pero no lighttpd, así que tras preguntar a SanGoogle, esto es lo que encontré:</p>
<p><code>server.modules += ( "mod_simple_vhost" , "mod_rewrite" )</p>
<p>$HTTP ["host"] == "jobeet" {<br />
  server.document-root = "/home/sfprojects/jobeet/web"<br />
  server.indexfiles = ( "index.php", "index.html")<br />
  alias.url            = (<br />
      "/sf"           => "/usr/share/php/data/symfony/web/sf"<br />
    )<br />
  server.error-handler-404 = "/index.php"<br />
}<br />
</code> </p>
<p>Como véis, es un código muy sencillo a añadir al archivo de configuración de lighttpd (en debian, /etc/lighttpd/lighttpd.conf). En mi caso, he creado el host jobeet para ir probando el <a href="http://www.symfony-project.org/jobeet/1_2/en/"> nuevo tutorial de 24 días que se está publicando en la web oficial de symfony</a>. Lo primero que necesitamos son los módulos de vhost y rewrite, si no los teníamos anteriormente &#8220;cargados&#8221;. Después simplemente le decimos donde está el directorio raíz del host (en mi caso, en un directorio que he creado en /home para todos los proyectos de symfony llamado sfprojects/ , y dentro de él, en el de nombre &#8220;jobeet&#8221;, en su directorio web/). Y por último, redirigimos el directorio /sf al directorio donde hayamos instalado symfony. En debian, y con la instalación de symfony mediante PEAR, por defecto está en /usr/share/php/data/symfony/web/sf.</p>
<p>Et voilà, reiniciamos lighttpd y ya tenemos el proyecto con symfony funcionando ;)</p>
<p>PD: No olvidar añadir la IP del servidor y el nombre del host, en esta caso &#8220;jobeet&#8221;, a nuestro archivo de hosts local&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2008/12/02/configurar-lighttpd-para-albergar-un-proyecto-con-symfony/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Symfony 1.2.0</title>
		<link>http://www.zelofan.net/blog/2008/12/02/symfony-120/</link>
		<comments>http://www.zelofan.net/blog/2008/12/02/symfony-120/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 15:43:30 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=726</guid>
		<description><![CDATA[Ya está disponible la versión 1.2.0 definitiva de Symfony, tras varios meses de desarrollo y diferentes betas. Mejoras en los formularios, en el generador automático del &#8220;backend&#8221; de administración y mil cosas más, que puedes ver en su web, por ejemplo, en su what&#8217;s new. He ido probando las betas y los cambios respecto a [...]]]></description>
			<content:encoded><![CDATA[<p>Ya está disponible la versión 1.2.0 definitiva de <a href="http://www.symfony-project.com">Symfony</a>, tras varios meses de desarrollo y diferentes betas. Mejoras en los formularios, en el generador automático del &#8220;backend&#8221; de administración y mil cosas más, que puedes ver en su web, por ejemplo, en su <a href="http://www.symfony-project.org/tutorial/1_2/whats-new">what&#8217;s new</a>. </p>
<p>He ido probando las betas y los cambios respecto a 1.0-1.1 son sustanciales, ahora sólo me falta meterle mano a la versión definitiva y ver si han corregido todos los pequeños fallos que tenían en las betas. Espero comentar más cosas (buenas) pronto&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2008/12/02/symfony-120/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cómo llamar al método de una clase con una variable en PHP</title>
		<link>http://www.zelofan.net/blog/2008/10/29/como-llamar-al-metodo-de-una-clase-con-una-variable-en-php/</link>
		<comments>http://www.zelofan.net/blog/2008/10/29/como-llamar-al-metodo-de-una-clase-con-una-variable-en-php/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 07:47:39 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=690</guid>
		<description><![CDATA[Llevo un tiempo currando con Symfony y, hasta ahora, no me había encontrado nunca con el problema de llamar a una clase a través de una variable. El problema me surgió ayer al querer refactorizar unas funciones y tener que llamar a una clase determinada, que tenía guardada en una variable. Después de tirarme un [...]]]></description>
			<content:encoded><![CDATA[<p>Llevo un tiempo currando con <a href="http://www.symfony-project.org/">Symfony</a> y, hasta ahora, no me había encontrado nunca con el problema de llamar a una clase a través de una variable. El problema me surgió ayer al querer refactorizar unas funciones y tener que llamar a una clase determinada, que tenía guardada en una variable.</p>
<p>Después de tirarme un buen rato buscando algún tipo de sintaxis que funcionara para hacer algo como $clase::metodo(), fui a donde debía haber ido desde el principio, a <a href="http://www.php.net">la web de PHP</a>, donde me enteré que hasta la próxima versión 5.3.0 no será posible llamar a los métodos de esa forma. Una posible solución que encontré, por si alguien lo necesita alguna vez (yo mismo, por ejemplo :D), es utilizar la función call_user_func de la siguiente forma:</p>
<p><code>call_user_func(array($clase,'metodo'), $parametros);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2008/10/29/como-llamar-al-metodo-de-una-clase-con-una-variable-en-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generar pantallazo de un vídeo.</title>
		<link>http://www.zelofan.net/blog/2008/03/27/generar-pantallazo-de-un-video/</link>
		<comments>http://www.zelofan.net/blog/2008/03/27/generar-pantallazo-de-un-video/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 14:16:11 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=375</guid>
		<description><![CDATA[La última función que he tenido que crear para un proyecto era una para generar un pantallazo en jpg de un fotograma de un vídeo .flv. No recuerdo en qué web encontré la respuesta, pero pasaba por utilizar ffmpeg. Este es el método que me ha quedado: function Genera_Pantallazo($origen,$fotograma) { $destino=substr_replace($origen,".jpg",-4); $segundos=$fotograma; $horas = intval($segundos/3600); [...]]]></description>
			<content:encoded><![CDATA[<p>La última función que he tenido que crear para un proyecto era una para generar un pantallazo en jpg de un fotograma de un vídeo .flv. No recuerdo en qué web encontré la respuesta, pero pasaba por utilizar ffmpeg. </p>
<p>Este es el método que me ha quedado:</p>
<pre lang="php" line="1">
function Genera_Pantallazo($origen,$fotograma) {
	$destino=substr_replace($origen,".jpg",-4);

	$segundos=$fotograma;
	$horas = intval($segundos/3600);
	$segundos -= $horas*3600;
	$minutos = intval($segundos/60);
	$segundos -= $minutos*60;
	$tiempo=$horas.":".$minutos.":".$segundos;

	$comando="ffmpeg -i $origen -vcodec mjpeg -ss $tiempo -vframes 1 -f image2 $destino";

	// echo "Ejecutamos $comando";  <--- Para comprobar que formábamos bien el comando
	exec($comando);

	return basename($destino);
}
</pre>
<p>Como véis, es bastante sencillo. Recibimos 2 variables: la ruta origen al fichero de vídeo y el número del segundo del que queremos generar el pantallazo. Lo primero que hacemos es especificar la ruta destino, que será la misma que la de origen, pero cambiando la extensión a .jpg. </p>
<p>Después realizamos el cálculo de horas, minutos y segundos a partir de los segundos que hemos pasado, para componer una cadena del tipo HH:MM:SS, que es la que pasaremos, a continuación, a ffmpeg, al cual le indicamos el codec de salida, el número de frames (1 para el pantallazo) y las rutas.</p>
<p>Por último, devuelvo el nombre del fichero generado. Modificar al gusto ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2008/03/27/generar-pantallazo-de-un-video/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ideas en mente: JS y PHP por un tubo</title>
		<link>http://www.zelofan.net/blog/2007/12/26/ideas-en-mente-js-y-php-por-un-tubo/</link>
		<comments>http://www.zelofan.net/blog/2007/12/26/ideas-en-mente-js-y-php-por-un-tubo/#comments</comments>
		<pubDate>Wed, 26 Dec 2007 17:24:20 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=279</guid>
		<description><![CDATA[Llevo varias semanas intentando ponerme y nunca lo hago. Por un lado, quiero aprender &#8220;bien&#8221;, de una vez, JavaScript y, de paso, echarle un ojo tanto a ExtJS (las malas compañías&#8230;) como a famosas librerías JS tipo jQuery o Prototype. De paso, quiero meterme a fondo con algún framework PHP, seguramente Symfony, aunque no descarto [...]]]></description>
			<content:encoded><![CDATA[<p>Llevo varias semanas intentando ponerme y nunca lo hago. Por un lado, quiero aprender &#8220;bien&#8221;, de una vez, JavaScript y, de paso, echarle un ojo tanto a <a href="http://extjs.com">ExtJS</a> (las malas compañías&#8230;) como a famosas librerías JS tipo <a href="http://jquery.com">jQuery</a> o <a href="http://www.prototypejs.org">Prototype</a>. </p>
<p>De paso, quiero meterme a fondo con algún framework PHP, seguramente <a href="http://www.symfony.com">Symfony</a>, aunque no descarto <a href="http://www.cakephp.org">CakePHP</a> o <a href="http://framework.zend.com/">Zend Framework</a> (¿alguna sugerencia para inclinarme por uno de ellos?).</p>
<p>Y para practicar un poco de todo esto, llevarlo a la práctica mediante el desarrollo de una aplicación web para la gestión de aulas-alumnos-clases tipo <a href="http://www.siestta.org">Siestta</a>. </p>
<p>Ya veremos en qué queda todo, si en sólo buenas intenciones o en algo más&#8230; :D</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2007/12/26/ideas-en-mente-js-y-php-por-un-tubo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalando Symfony en Mac OSX</title>
		<link>http://www.zelofan.net/blog/2007/09/24/instalando-symfony-en-mac-osx/</link>
		<comments>http://www.zelofan.net/blog/2007/09/24/instalando-symfony-en-mac-osx/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 18:59:17 +0000</pubDate>
		<dc:creator>ramses</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[mamp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.zelofan.net/blog/?p=178</guid>
		<description><![CDATA[Una de los cosas que tenía pendientes por hacer en el MacBook era instalar Apache+Mysql+PHP y probar Symfony, uno de los más famosos frameworks para el desarrollo rápido de aplicaciones web en PHP. Lo primero no pudo ser más fácil, pero lo segundo ya me costó bastante más, por lo que me he decidido a [...]]]></description>
			<content:encoded><![CDATA[<p>Una de los cosas que tenía pendientes por hacer en el MacBook era instalar Apache+Mysql+PHP y probar Symfony, uno de los más famosos frameworks para el desarrollo rápido de aplicaciones web en PHP.</p>
<p>Lo primero no pudo ser más fácil, pero lo segundo ya me costó bastante más, por lo que me he decidido a escribir mi experiencia, por si a alguien le sirve.</p>
<p>Para instalar Apache+MySQL+PHP no hay más que descargarse <a href="http://www.mamp.info/">MAMP</a> (actualmente, versión 1.7) e instalarlo como cualquier otra aplicación en OSX. Una vez instalado podremos comprobar su funcionamiento ejecutando la aplicación, y viendo como lanza los servicios de apache y mysql,  junto a la página de inicio de Apache en el navegador.</p>
<p>El problema viene con <a href="http://www.symfony-project.com/">Symfony</a>. Intenté instalarlo tal como lo describen <a href="http://wp.omeeza.com/sunhwan/2007/07/12/installing-symfony-in-mac-with-xampp/">en esta web</a>, pero, primero por mi inexperiencia con Mac, y después por diferentes errores enlazando librerías, no fui capaz de hacerlo funcionar (aunque sí me ha servido como excelente base para este documento).</p>
<p>Lo primero que hay que hacer es abrir un terminal y añadir al path de nuestro sistema las siguientes rutas, editando para ello el archivo /etc/profile (válido para todos los usuario del sistema):</p>
<p><code><br />
# sudo nano -w /etc/profile<br />
</code><br />
Una vez abierto, modificamos la línea del PATH y añadimos la de DYLD_LIBRARY_PATH:<br />
<code><br />
PATH="/Applications/MAMP/bin:/Applications/MAMP/bin/php5/bin:<br />
            /bin:/sbin:/usr/bin:/usr/sbin"</p>
<p>export PATH</p>
<p>export DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib"<br />
</code><br />
y guardamos el fichero (ctrl+x en el editor nano, se puede utilizar cualquier otro editor a tu gusto ;) ). Fijáos que añadimos las rutas ANTES del path que ya existía. De esta forma nos aseguramos que los comandos que utilizaremos son los que acabamos de instalar con MAMP (muy importante, ya que si no, utilizaría, por ejemplo, el php que lleva OSX por defecto)</p>
<p>La segunda línea he tenido que añadirla, ya que al ejecutar pear o symfony más tarde, no encontraba la ruta de las librerías.</p>
<p>Ahora ya podemos ejecutar el pear y el php recién instalados mediante MAMP. Para instalar symfony necesitamos identificarnos como root, utilizando sudo, y ejecutando peardev (con pear no funciona por un error en los límites de memoria de php. Esto se puede solucionar editando el archivo php.ini y cambiando memory_limit a 16M, por ejemplo, como indica noelmf en los comentarios). En la web que he enlazado anteriormente indicaba ejecutar lo siguiente:</p>
<p><code><br />
# sudo peardev channel-discover pear.symfony-project.com<br />
# sudo peardev install symfony/symfony<br />
</code></p>
<p>Aquí he tenido otro problema: aunque había añadido la ruta de las librerías en el profile, si ejecutaba el comando con sudo, el path funcionaba pero la ruta de la librería no :S (si hay algún entendido de Mac, por favor, que deje sus comentarios al final&#8230;). Para solucionar este tema, lo que he hecho ha sido crear un archivo instalarsymfony.sh con el siguiente contenido:</p>
<p><code><br />
#/bin/bash<br />
peardev channel-discover pear.symfony-project.com<br />
peardev install symfony/symfony<br />
</code></p>
<p>y después ejecutar este script como root, tras darle permisos de ejecución:</p>
<p><code><br />
# chmod +x instalarsymfony.sh<br />
# sudo instalarsymfony.sh<br />
</code></p>
<p><b>Actualizado 26/09/07:</b> Como nos comenta <a href="http://sildavia.net">Marino</a>, podemos evitarnos este paso entrando como root mediante &#8220;sudo su -&#8221; y ejecutando allí los los comandos de peardev anteriores (la explicación, en el primer comentario)</p>
<p>Por fin, tenemos instalado Symfony. Podemos comprobarlo con el comando:</p>
<p><code><br />
# symfony -V<br />
</code></p>
<p>Este comando nos muestra la versión instalada de Symfony, en mi caso, la 1.0.7.</p>
<p>Para comprobar que todo funciona correctamente, vamos a crear un proyecto y a configurar Apache con un host virtual. Lo primero es crear un directorio nuevo en nuestro home, el proyecto symfony (symfony_project, por ejemplo) y la aplicación inicial para ese proyecto (symfony_app, para seguir la nomenclatura anterior):</p>
<p><code><br />
# mkdir symfony_project<br />
# cd symfony_project<br />
# symfony init-project symfony_project<br />
# symfony init-app symfony_app<br />
</code></p>
<p>Ahora debemos configurar un host virtual en Apache, modificando el archivo /Applications/MAMP/conf/apache/httpd.conf</p>
<p><code><br />
# nano -w /Applications/MAMP/conf/apache/httpd.conf<br />
</code></p>
<p>y añadimos estas líneas al final del fichero:</p>
<p><code><br />
&lt;VirtualHost *:80&gt;<br />
  ServerName example.symfony_project.com<br />
  DocumentRoot "/users/ramses/symfony_project/web"<br />
  DirectoryIndex index.php<br />
  Alias /sf /Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf<br />
  &lt;Directory "/Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf"&gt;<br />
    AllowOverride All<br />
    Allow from All<br />
  &lt;/Directory&gt;<br />
  &lt;Directory "/users/ramses/symfony_project/web"&gt;<br />
    AllowOverride All<br />
    Allow from All<br />
  &lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;<br />
</code></p>
<p>Tras esto, en MAMP he modificado el puerto de Apache, poniendo el 80 (preferencias->usar los puertos por defecto de Apache y MySQL) y reiniciamos los servicios (detener servidores-iniciar servidores). <b>Actualizado 26/09/07: </b>Como bien nos recuerda <a href="http://sildavia.net">Mariano</a> en los comentarios, para poder ejecutar el Apache de MAMP en el puerto 80, es necesario no tener corriendo el Apache original de Mac OSX (preferencias->compartir->compartir web)</p>
<p>Ahora sólo tenemos que abrir una ventana de nuestro navegador favorito e ir a la dirección que hayamos creado. En mi caso http://localhost/symfony_app_dev.php/</p>
<div align="center"><a href='http://www.zelofan.net/blog/wp-content/uploads/2007/09/symfony.jpg' title='symfony.jpg'><img src='http://www.zelofan.net/blog/wp-content/uploads/2007/09/symfony.jpg' alt='symfony.jpg' /></a></div>
<p>Enlaces interesantes:<br />
<a href="http://www.symfony-project.com">Web oficial de Symfony</a><br />
<a href="http://www.symfony.es">Comunidad española sobre Symfony</a><br />
<a href="http://wp.omeeza.com/sunhwan/2007/07/12/installing-symfony-in-mac-with-xampp/">Documento de referencia sobre cómo instalar Symfony sobre MAMP</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zelofan.net/blog/2007/09/24/instalando-symfony-en-mac-osx/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>

