<?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>admirableadmin &#187; pear</title>
	<atom:link href="http://admirableadmin.de/tag/pear/feed" rel="self" type="application/rss+xml" />
	<link>http://admirableadmin.de</link>
	<description>&#34;Suchst du noch oder lebst du schon?&#34;</description>
	<lastBuildDate>Sun, 20 May 2012 14:31:19 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Install Nginx with PHP on Ubuntu</title>
		<link>http://admirableadmin.de/195/install-nginx-with-php-on-ubuntu</link>
		<comments>http://admirableadmin.de/195/install-nginx-with-php-on-ubuntu#comments</comments>
		<pubDate>Sun, 20 May 2012 14:31:19 +0000</pubDate>
		<dc:creator>admirableadmin</dc:creator>
				<category><![CDATA[en]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://admirableadmin.de/?p=195</guid>
		<description><![CDATA[Developing your own PHP Applications with Netbeans is very easy and require only a few steps to install and configure Nginx with PHP on your local Ubuntu System. Note: An other Guide is available how to install Nginx with PHP on Debian. 1. Install packages First step is to install the required packages php5-cgi, spawn-fcgi and [...]]]></description>
			<content:encoded><![CDATA[<p>Developing your own PHP Applications with Netbeans is very easy and require only a few steps to install and configure Nginx with PHP on your local Ubuntu System.</p>
<p><span id="more-195"></span></p>
<p>Note: An other Guide is available how to <a title="Installing nginx with PHP on Debian" href="http://admirableadmin.de/190/installing-nginx-with-php-on-debian">install Nginx with PHP on Debian</a>.</p>
<p><strong>1. Install packages</strong></p>
<p>First step is to install the required packages php5-cgi, spawn-fcgi and nginx. While phpunit, php-pear and smarty are optional, one should install at least php5-suhosin for security reasons. However all together uses only 50MB of hard disk space:</p>
<p class="code">$ sudo apt-get update<br />
$ sudo apt-get install php5-cgi nginx spawn-fcgi php5-suhosin phpunit php-pear smarty<br />
$ sudo /etc/init.d/nginx start</p>
<p>After that open a browser to <a href="http://localhost/" target="_blank">http://localhost/</a> and verify Nginx is working:</p>
<p><img class="alignnone size-full wp-image-200" title="Screenshot-from-2012-05-07-21:03:01-welcome-to-nginx" src="http://admirableadmin.de/wp-uploads/Screenshot-from-2012-05-07-210301-welcome-to-nginx.png" alt="" width="517" height="303" /></p>
<p><strong>2. Configure home directory</strong></p>
<p>Netbeans will work with a public_html directory located in your /home/username folder. But Nginx can&#8217;t access them because of inadequate rights.</p>
<p><img class="alignnone size-full wp-image-201" title="Screenshot-from-2012-05-07-21:07:07-nginx-and-home" src="http://admirableadmin.de/wp-uploads/Screenshot-from-2012-05-07-210707-nginx-and-home.png" alt="" width="514" height="263" /></p>
<p>Instead of changing the permission and letting everyone access your home-directory (777 is indeed a bad idea), create a folder below the default Nginx directory with you username and appropriate permission (replace <strong>ap</strong> with your username/group) and pointing a symbolic link to it:</p>
<p class="code">$ sudo mkdir /usr/share/nginx/www/~<strong>ap</strong><br />
$ ln -s /usr/share/nginx/www/~<strong>ap</strong> /home/<strong>ap</strong>/public_html<br />
$ sudo chown <strong>ap</strong>:<strong>ap</strong> /usr/share/nginx/www/~<strong>ap</strong>/</p>
<p>If every thing works fine a 403 Forbidden Error is displayed at your localhost (because there is no file at the moment and directory listing is disabled by default).</p>
<p><img class="alignnone size-full wp-image-202" title="Screenshot-from-2012-05-07-21:08:51-nginx-forbidden" src="http://admirableadmin.de/wp-uploads/Screenshot-from-2012-05-07-210851-nginx-forbidden.png" alt="" width="517" height="303" /></p>
<p><strong>3. Configure PHP</strong></p>
<p>Edit the file <em>/etc/rc.local</em> and put the following line above the “exit 0″:</p>
<p class="code">/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid</p>
<p>Now on every reboot of you system it starts on localhost port 9000 the php fcgi parsing service. You should also type this command in your console (with sudo in front) to run it now.</p>
<p><strong>4. Configure nginx</strong></p>
<p>Now change the config file located at <em>/etc/nginx/sites-available/default</em> to enable and configure the php settings. Uncomment the following lines:</p>
<p class="code">location ~ \.php$ {<br />
fastcgi_split_path_info ^(.+\.php)(/.+)$;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
include fastcgi_params;<br />
}</p>
<p>To ensure index.php files are parsed by default one can change the &#8220;index&#8221; setting, and to display all files in a directory add optional the &#8220;autoindex&#8221; feature:</p>
<p class="code">index index.html index.htm index.php;<br />
autoindex on;</p>
<p>Note: in my case there was no need to change php.ini, because &#8220;cgi.fix_pathinfo=1&#8243; is not active.</p>
<p>For testing you can create a <em>index.php</em> inside<em> /usr/share/nginx/www/~<strong>ap</strong>/<br />
</em></p>
<p class="code">&lt;?php<br />
phpinfo();<br />
?&gt;</p>
<p>and after a restart of your webserver you should see the phpinfo page</p>
<p class="code">$ sudo /etc/init.d/nginx restart</p>
<p><img class="alignnone size-full wp-image-203" title="Screenshot-from-2012-05-07-21:26:42-nginx-phpinfo" src="http://admirableadmin.de/wp-uploads/Screenshot-from-2012-05-07-212642-nginx-phpinfo.png" alt="" width="517" height="303" /></p>
<p><strong>5. Optional: Work with Netbeans</strong></p>
<p>If one want to create a new project:</p>
<p class="code">1. php -&gt; php application<br />
2. Name and Location -&gt; select project directory, i.e. svn folder<br />
3. Run configuration<br />
-&gt; Project Url: http://localhost/~<strong>ap</strong>/PhpProject1/<br />
-&gt; choose &#8220;Copy to Folder&#8221;: /home/<strong>ap</strong>/public_html/PhpProject1<br />
4. PHP Framework (select nothing)</p>
<p><strong>7. Optional: PEAR</strong></p>
<p>If one work with PEAR (PHP Extension and Application Repository) and want to install a beta package:</p>
<p class="code">$ sudo pear upgrade<br />
$ pear config-set preferred_state beta<br />
$ sudo pear install XML_Serializer<br />
$ pear config-set preferred_state stable</p>
<p class="favorite"><a href="http://wiki.nginx.org/Pitfalls" target="_blank">http://wiki.nginx.org/Pitfalls</a><br />
<a href="http://wiki.nginx.org/PHPFcgiExample" target="_blank"> http://wiki.nginx.org/PHPFcgiExample</a><br />
<a href="http://wiki.nginx.org/NginxFullExample" target="_blank"> http://wiki.nginx.org/NginxFullExample</a><br />
<a href="http://nginxlibrary.com/resolving-no-input-file-specified-error/" target="_blank"> http://nginxlibrary.com/resolving-no-input-file-specified-error/</a><br />
<a href="http://wiki.ubuntuusers.de/nginx" target="_blank"> http://wiki.ubuntuusers.de/nginx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://admirableadmin.de/195/install-nginx-with-php-on-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ip2map &#8211; geografische IP-Anzeige mit Ajax</title>
		<link>http://admirableadmin.de/21/ip2map-geografische-ip-anzeige-mit-ajax</link>
		<comments>http://admirableadmin.de/21/ip2map-geografische-ip-anzeige-mit-ajax#comments</comments>
		<pubDate>Mon, 10 Sep 2007 22:05:58 +0000</pubDate>
		<dc:creator>admirableadmin</dc:creator>
				<category><![CDATA[de]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web-2.0]]></category>

		<guid isPermaLink="false">http://admirableadmin.de/21/</guid>
		<description><![CDATA[Google bietet viele zumeist kostenlose Dienste an, unter anderem auch das beliebte Google-Maps welches auch für die eigene Homepage verwendet werden kann, nicht nur um einen Anfahrtsplan anzuzeigen. Um den ungefähren Standort einer IP-Adresse (Wikipedia) in einer Landkarte anzuzeigen, wird das sog. Geotargeting (Wikipedia) verwendet. 1. Voraussetzungen Dazu ist neben einem kostenlosen &#8220;Google Maps API [...]]]></description>
			<content:encoded><![CDATA[<p>Google bietet viele zumeist <a href="http://www.google.de/intl/de/options/" target="_blank">kostenlose Dienste</a> an, unter anderem auch das beliebte <a href="http://maps.google.de/maps" target="_blank">Google-Maps</a> welches auch für die eigene Homepage verwendet werden kann, nicht nur um einen Anfahrtsplan anzuzeigen.</p>
<p><span id="more-21"></span></p>
<p>Um den ungefähren Standort einer IP-Adresse (<a href="http://de.wikipedia.org/wiki/IP-Adresse" target="_blank">Wikipedia</a>) in einer Landkarte anzuzeigen, wird das sog. Geotargeting (<a href="http://de.wikipedia.org/wiki/Geotargeting" target="_blank">Wikipedia</a>) verwendet.</p>
<p><strong>1. Voraussetzungen</strong></p>
<p>Dazu ist neben einem kostenlosen &#8220;<a href="http://www.google.com/apis/maps/index.html">Google Maps API key</a>&#8221; eine Datenbank nötig, welche der IP-Adressen einer geografischen Position zuordnen kann. Der Hersteller <a href="http://maxmind.com/" target="_blank">MaxMind</a> bietet mit <a href="http://www.maxmind.com/app/geolitecity">GeoLite City</a> eine kostenlose Datenbank (LGPL-Lizenz) welche dazu optimal geeignet ist.</p>
<p><strong>2. Installation von PEAR Net_GeoIP</strong></p>
<p>In Kombination mit dem PHP PEAR-Paket <a href="http://pear.php.net/package/Net_GeoIP/" target="_blank">Net_GeoIP</a> können nun Anfragen an die Datenbank gestellt werden um diese grafisch ausgegeben zu können. Dieses Paket befindet sich zwar unverändert seit einem Jahr im Beta-Stadium, kann aber einfach installiert werden über:</p>
<p class="code">pear install channel://pear.php.net/Net_GeoIP-1.0.0RC1</p>
<p><strong>3. Programmfunktion mit AJAX (index.php)<br />
</strong></p>
<p>Aktuell ist der Web 2.0 Standards (<a href="http://de.wikipedia.org/wiki/Web_2.0" target="_blank">Wikipedia</a>) das Maß der Dinge, warum auch hier AJAX (<a href="http://de.wikipedia.org/wiki/Ajax_%28Programmierung%29" target="_blank">Wikipdia</a>) eingesetzt wird. Dazu gilt es zu allererst zu beachten, dass die Browser intern unterschiedlich die Daten anfordern. Um dies zu umgehen gibt es eine Möglichkeit um <a href="http://design-noir.de/webdev/JS/XMLHttpRequest-IE/" target="_blank">XMLHttpRequest Anfragen im Internet-Explorer</a> und in anderen Browsern gleichermaßen zu behandeln. Eine Erklärung der einzelnen Funktionen der Google-Map lässt sich über die umfangreiche <a href="http://www.google.com/apis/maps/documentation/" target="_blank">API-Dokumentation</a> nachschlagen.</p>
<p><strong>4. Zugriff auf die Datenbank (GeoLiteCity.php)</strong></p>
<p>Aus der Datenbank werden nur die Koordinaten-Werte (Latitude/Longitude) benötigt. Weitere Ausgaben wie Stadt und Region sind ebenfalls möglich. Diese würden sich dann ebenfalls in der Landkarte anzeigen lassen.</p>
<p><strong>5. Finale</strong></p>
<p class="favorite"><a href="http://able.admirableadmin.de/ip2map/">Beispiel<br />
</a><a href="http://able.admirableadmin.de/ip2map/admirableadmin-ip2map-070911.tgz">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://admirableadmin.de/21/ip2map-geografische-ip-anzeige-mit-ajax/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

