<?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>PHP Gangsta - Der PHP Blog mit Praxisbezug &#187; HTTP Authorization</title> <atom:link href="http://www.phpgangsta.de/tag/http-authorization/feed" rel="self" type="application/rss+xml" /><link>http://www.phpgangsta.de</link> <description>Ein PHP Blog mit Themen aller Art. Manchmal vergewaltige ich PHP...</description> <lastBuildDate>Thu, 02 Feb 2012 22:22:51 +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>PHP und HTTP AUTH bei 1und1 Webhosting</title><link>http://www.phpgangsta.de/php-und-http-auth-bei-1und1-webhosting</link> <comments>http://www.phpgangsta.de/php-und-http-auth-bei-1und1-webhosting#comments</comments> <pubDate>Sat, 06 Feb 2010 09:53:47 +0000</pubDate> <dc:creator>Michael Kliewe</dc:creator> <category><![CDATA[Allgemein]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[1und1 Webhosting]]></category> <category><![CDATA[htaccess]]></category> <category><![CDATA[HTTP Authorization]]></category> <category><![CDATA[PHP_AUTH_PW]]></category> <category><![CDATA[PHP_AUTH_USER]]></category> <category><![CDATA[x-mapp-php5]]></category><guid isPermaLink="false">http://www.phpgangsta.de/?p=891</guid> <description><![CDATA[Um das Zend Framework in der Webhosting-Umgebung bei 1und1 ans Laufen zu bekommen, gibt es ein paar Kleinigkeiten zu beachten: Als erstes muss man bei 1und1 in der .htaccess-Datei angeben welche PHP-Version man benutzen möchte. Dies macht man mit der Zeile Außerdem muß man noch die folgenden 2 Zeilen hinzufügen, sonst erhält man einen 500er [...]<br/><br/> Ähnliche Artikel:<ol><li><a href='http://www.phpgangsta.de/blog-url-struktur-geandert' rel='bookmark' title='Blog URL Struktur geändert'>Blog URL Struktur geändert</a></li></ol>]]></description> <content:encoded><![CDATA[<p>Um das <a href="http://framework.zend.com/" target="_blank">Zend Framework</a> in der Webhosting-Umgebung bei 1und1 ans Laufen zu bekommen, gibt es ein paar Kleinigkeiten zu beachten:</p><p>Als erstes muss man bei 1und1 in der <a href="http://de.wikipedia.org/wiki/.htaccess" target="_blank">.htaccess-Datei</a> angeben <a href="http://faq.1and1.com/scripting_languages_supported/php/9.html" target="_blank">welche PHP-Version man benutzen möchte</a>. Dies macht man mit der Zeile</p><pre class="brush: plain; title: ; notranslate">AddType x-mapp-php5 .php</pre><p>Außerdem muß man noch die folgenden 2 Zeilen hinzufügen, sonst erhält man einen 500er Fehler:</p><pre class="brush: plain; title: ; notranslate">Options -MultiViews
RewriteBase /</pre><p>Die RewriteBase gilt es natürlich anzupassen falls das Projekt über einen anderen Pfad erreicht werden muss.</p><p>Da PHP bei 1und1 als CGI läuft, muß man für die <a href="http://de.wikipedia.org/wiki/HTTP-Authentifizierung" target="_blank">HTTP-Authentifizierung</a> auch noch einen kleinen Workaround einbauen:</p><pre class="brush: plain; title: ; notranslate">RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</pre><p>Damit wird die Authentifizierungsinformation in die Variable $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] geschrieben. Das sieht dann ungefähr so aus:</p><pre class="brush: plain; title: ; notranslate">echo $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
//  Basic: d2lraTpwZWRpYQ==</pre><p>Das ist die Base64-Darstellung von &#8220;Username:Passwort&#8221;.</p><p>Die entgültige .htaccess sieht dann so aus:</p><pre class="brush: plain; title: ; notranslate">AddType x-mapp-php5 .php
Options -MultiViews

RewriteEngine On
RewriteBase /

# workaround for 1und1 php cgi mode
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]</pre><p>Und so kommt man an Username + Passwort heran:</p><pre class="brush: php; title: ; notranslate">if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
 list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
}</pre><br/><br/><p>Ähnliche Artikel:</p><ol><li><a href='http://www.phpgangsta.de/blog-url-struktur-geandert' rel='bookmark' title='Blog URL Struktur geändert'>Blog URL Struktur geändert</a></li></ol>]]></content:encoded> <wfw:commentRss>http://www.phpgangsta.de/php-und-http-auth-bei-1und1-webhosting/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic
Database Caching 1/13 queries in 0.007 seconds using disk: basic
Object Caching 599/601 objects using disk: basic

Served from: www.phpgangsta.de @ 2012-02-04 13:39:19 -->
