Xampp php geht php Datei zeigt nur Code RICHTIG AUFGERUFEN!

Irgendwelche Probleme mit XAMPP für Windows? Dann ist hier genau der richtige Ort um nachzufragen.

Xampp php geht php Datei zeigt nur Code RICHTIG AUFGERUFEN!

Postby webhero » 10. October 2012 19:04

Hallo zusammen,

habe ein Problem, das mich schon einige Stunden beschäftigt. Ich habe XAMPP 1.8.1 auf meinen Windows 7 x64 PC installiert und habe eine php-Datei "magento-chek.php" in das Verzeichnis XAMPP/htdocs/magento-check/magento-check.php kopiert Beim Aufruf localhost wird die Startseite von XAMPP aufgerufen und alle weiteren Seiten laufen genauso. Sind ja auch php-Dateien. Rufe ich jetzt aber durch localhost/magento-check/magento-check.php bekomme ich nur den Quellcode der php-Datei angezeigt. Er wird also nicht interpretiert. Das sieht dann so aus (Kopie aus Browserfenster)
Code: Select all
You need PHP 5.2.0 (or greater)'; } else { $pass .='
You have PHP 5.2.0 (or greater)
'; } if(!ini_get('safe_mode')) { $pass .='
Safe Mode is off
'; preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version); if(version_compare($version[0], '4.1.20', '<')) { $fail .= '
You need MySQL 4.1.20 (or greater)
'; } else { $pass .='
You have MySQL 4.1.20 (or greater)
'; } } else { $fail .= '
Safe Mode is on
'; } foreach($extensions as $extension) { if(!extension_loaded($extension)) { $fail .= '
You are missing the '.$extension.' extension
'; } else{ $pass .= '
You have the '.$extension.' extension
'; } } if($fail) { echo '

Your server does not meet the following requirements in order to install Magento.'; echo '
The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:'; echo '

    '.$fail.'

'; echo 'The following requirements were successfully met:'; echo '

    '.$pass.'

'; } else { echo '

Congratulations! Your server meets the requirements for Magento.
'; echo '

    '.$pass.'

'; } } ?>


Meine magento-check.php hat folgenden Code
Code: Select all
<?
extension_check(array(
   'curl',
   'dom',
   'gd',
   'hash',
   'iconv',
   'mcrypt',
   'pcre',
   'pdo',
   'pdo_mysql',
   'simplexml'
));

function extension_check($extensions) {
   $fail = '';
   $pass = '';
   
   if(version_compare(phpversion(), '5.2.0', '<')) {
      $fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater)</li>';
   }
   else {
      $pass .='<li>You have<strong> PHP 5.2.0</strong> (or greater)</li>';
   }

   if(!ini_get('safe_mode')) {
      $pass .='<li>Safe Mode is <strong>off</strong></li>';
      preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
      
      if(version_compare($version[0], '4.1.20', '<')) {
         $fail .= '<li>You need<strong> MySQL 4.1.20</strong> (or greater)</li>';
      }
      else {
         $pass .='<li>You have<strong> MySQL 4.1.20</strong> (or greater)</li>';
      }
   }
   else { $fail .= '<li>Safe Mode is <strong>on</strong></li>';  }

   foreach($extensions as $extension) {
      if(!extension_loaded($extension)) {
         $fail .= '<li> You are missing the <strong>'.$extension.'</strong> extension</li>';
      }
      else{   $pass .= '<li>You have the <strong>'.$extension.'</strong> extension</li>';
      }
   }
   
   if($fail) {
      echo '<p><strong>Your server does not meet the following requirements in order to install Magento.</strong>';
      echo '<br>The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:';
      echo '<ul>'.$fail.'</ul></p>';
      echo 'The following requirements were successfully met:';
      echo '<ul>'.$pass.'</ul>';
   } else {
      echo '<p><strong>Congratulations!</strong> Your server meets the requirements for Magento.</p>';
      echo '<ul>'.$pass.'</ul>';

   }
}
?>


Auf meinem shared-Server meines Providers läuft die Datei tadellos und gibt auch alles richtig aus. Was kann ich tun. bin ziemlich verzweifelt. Bitte helft mir!

error.log
Code: Select all
[Wed Oct 10 19:14:36.182112 2012] [ssl:warn] [pid 5080:tid 252] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:14:36.254112 2012] [mpm_winnt:notice] [pid 5080:tid 252] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Wed Oct 10 19:14:36.255112 2012] [mpm_winnt:notice] [pid 5080:tid 252] AH00456: Server built: Aug 18 2012 12:41:37
[Wed Oct 10 19:14:36.255112 2012] [core:notice] [pid 5080:tid 252] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Oct 10 19:14:36.256112 2012] [mpm_winnt:notice] [pid 5080:tid 252] AH00418: Parent: Created child process 6180
[Wed Oct 10 19:14:37.363112 2012] [ssl:warn] [pid 6180:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:14:37.412112 2012] [mpm_winnt:notice] [pid 6180:tid 264] AH00354: Child: Starting 150 worker threads.
[Wed Oct 10 19:15:53.810112 2012] [core:warn] [pid 3220:tid 252] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Oct 10 19:15:54.179112 2012] [ssl:warn] [pid 3220:tid 252] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:15:54.224112 2012] [mpm_winnt:notice] [pid 3220:tid 252] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Wed Oct 10 19:15:54.224112 2012] [mpm_winnt:notice] [pid 3220:tid 252] AH00456: Server built: Aug 18 2012 12:41:37
[Wed Oct 10 19:15:54.224112 2012] [core:notice] [pid 3220:tid 252] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Oct 10 19:15:54.226112 2012] [mpm_winnt:notice] [pid 3220:tid 252] AH00418: Parent: Created child process 1632
[Wed Oct 10 19:15:55.312112 2012] [ssl:warn] [pid 1632:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:15:55.360112 2012] [mpm_winnt:notice] [pid 1632:tid 264] AH00354: Child: Starting 150 worker threads.
[Wed Oct 10 19:26:50.050957 2012] [core:warn] [pid 1848:tid 252] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Oct 10 19:26:50.448957 2012] [ssl:warn] [pid 1848:tid 252] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:26:50.494957 2012] [mpm_winnt:notice] [pid 1848:tid 252] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Wed Oct 10 19:26:50.494957 2012] [mpm_winnt:notice] [pid 1848:tid 252] AH00456: Server built: Aug 18 2012 12:41:37
[Wed Oct 10 19:26:50.494957 2012] [core:notice] [pid 1848:tid 252] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Oct 10 19:26:50.496957 2012] [mpm_winnt:notice] [pid 1848:tid 252] AH00418: Parent: Created child process 5588
[Wed Oct 10 19:26:51.608957 2012] [ssl:warn] [pid 5588:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:26:51.712957 2012] [mpm_winnt:notice] [pid 5588:tid 264] AH00354: Child: Starting 150 worker threads.
[Wed Oct 10 19:31:54.650957 2012] [core:warn] [pid 3216:tid 252] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Oct 10 19:31:55.011957 2012] [ssl:warn] [pid 3216:tid 252] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:31:55.075957 2012] [mpm_winnt:notice] [pid 3216:tid 252] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Wed Oct 10 19:31:55.075957 2012] [mpm_winnt:notice] [pid 3216:tid 252] AH00456: Server built: Aug 18 2012 12:41:37
[Wed Oct 10 19:31:55.075957 2012] [core:notice] [pid 3216:tid 252] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Oct 10 19:31:55.077957 2012] [mpm_winnt:notice] [pid 3216:tid 252] AH00418: Parent: Created child process 6412
[Wed Oct 10 19:31:56.347957 2012] [ssl:warn] [pid 6412:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Oct 10 19:31:56.395957 2012] [mpm_winnt:notice] [pid 6412:tid 264] AH00354: Child: Starting 150 worker threads.


So jetzt glaube ich habe ich alle wichtigen Infos.
webhero
 
Posts: 2
Joined: 10. October 2012 18:44
Operating System: Windows 7 x64

Re: Xampp php geht php Datei zeigt nur Code RICHTIG AUFGERUF

Postby Altrea » 10. October 2012 19:39

Hallo webhero,

kurze schnelle Antwort: short_open_tag
Nutze <?php statt <?

mit freundlichen Grüßen,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Xampp php geht php Datei zeigt nur Code RICHTIG AUFGERUF

Postby webhero » 10. October 2012 19:59

Danke für den Tipp. Durch recherche habe ich das gerade auch raus bekommen und es funktioniert. Anscheinend wird die Endung auf dem Server des Provider daztu verwendet php zu interpretieren. XAMPP braucht das php TAG.

Das Scripzt prüft, ob Magento 1.7.0.3 auf Xampp läuft. Leider bekomme ich jetzt folgende Fehlermeldung:
Code: Select all
Notice: Undefined offset: 0 in C:\xampp\htdocs\magento-check\magento-check.php on line 30

Your server does not meet the following requirements in order to install Magento.
The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:

    You need MySQL 4.1.20 (or greater)

The following requirements were successfully met:

    You have PHP 5.2.0 (or greater)
    Safe Mode is off
    You have the curl extension
    You have the dom extension
    You have the gd extension
    You have the hash extension
    You have the iconv extension
    You have the mcrypt extension
    You have the pcre extension
    You have the pdo extension
    You have the pdo_mysql extension
    You have the simplexml extension


XAMPP 1.8.1 hat doch MySQL 5.5.27. Warum diese Fehlermeldung. Der Hintergrund ist, dass ich die neusete Version von Magento installieren möchte. Mein Provider hat mir meine Datenbank zwar gesicher, kann Sie aber aus dem Backup aufgrund der vielen Dateien und innodb nicht mehr herstelln. Der Verlust ist dem Provider bei der Umstellung vom Test in den Livebetrieb passiert. Die DB war weg. Zwei Wochen harter Arbeit bis 2 Uhr morgens. Jetzt möchte ich das ganze lokal auf emienm Rechner (schneller) alles nochmal neu machen. Ich hoffe ihr habt was mein obiges Problem angeht gute Nachrichte.

Salute!

Thomas
webhero
 
Posts: 2
Joined: 10. October 2012 18:44
Operating System: Windows 7 x64

Re: Xampp php geht php Datei zeigt nur Code RICHTIG AUFGERUF

Postby Altrea » 11. October 2012 05:10

webhero wrote:Anscheinend wird die Endung auf dem Server des Provider daztu verwendet php zu interpretieren. XAMPP braucht das php TAG.

Nein. Sowohl der Live-Server als auch XAMPP benötigen ein einleitendes PHP Starttag, damit der PHP Interpreter weiß, welcher Teil geparst werden muss und welchen er als Klartext einfach nur weiterverwendet. Der Unterschied ist nur, dass PHP auf dem Live-Server die Kurzvariante des Starttags akzeptiert, XAMPP aber nicht. Es ist eine Konfigurationssache.
Solche Abhängigkeiten zu alten, nichtmehr als Standard angesehenden Einstellungen sollten aber sinnvollerweise nichtmehr global für alle Scripte in der php.ini geändert werden, sondern lokal in einer in dem Projektverzeichnis der jeweiligen Anwendung lokal liegenden .htaccess Datei.

Die Einstellung short_open_tag steht im Auslieferungszustand von PHP schon länger auf Off, um Inkompatibilitäten mit XML-Syntax zu vermeiden (manche Server aktivieren sie dennoch nachträglich, um Inkompatibilitäten mit unsauber programmierten Scripten wie dem deinen zu vermeiden).
Grundsätzlich sollte man PHP Scripte nicht von einzelnen PHP-Einstellungen abhängig machen, wenn es sich vermeiden lässt.

webhero wrote:Leider bekomme ich jetzt folgende Fehlermeldung:[code]
Notice: Undefined offset: 0 in C:\xampp\htdocs\magento-check\magento-check.php on line 30

Das ist keine Fehlermeldung (Error) sondern eine Hinweismeldung (Notice), die dir sagen soll, dass bei einem deiner Arrays kein nullter Index vorhanden ist, du diesen aber verwenden möchtest und zwar in Zeile 30 der Datei C:\xampp\htdocs\magento-check\magento-check.php.

webhero wrote:You need MySQL 4.1.20 (or greater)
[...]
XAMPP 1.8.1 hat doch MySQL 5.5.27. Warum diese Fehlermeldung.

Dein Datenbankcheck, so wie er jetzt programmiert ist, scheint ins leere zu laufen (deshalb auch die Hinweismeldung). Ich vermute mal ganz stark, dass dein shell_exec Aufruf nichtmehr das zurückliefert, was dein Script erwartet.
Seit PHP 5.4 haben einige Leute Probleme mit dem shell und system Kommandos.
Wenn es sich vermeiden lässt sollte man auf shell kommandos ganz verzichten, denn in der Regel hat man bei Hostern keinen Zugriff auf die Shell, weil das ein Sicherheitsrisiko darstellen würde.

webhero wrote:Der Verlust ist dem Provider bei der Umstellung vom Test in den Livebetrieb passiert. Die DB war weg. Zwei Wochen harter Arbeit bis 2 Uhr morgens.

Dafür gewinnst du bei mir keinen Blumentopf. Bei einem vernünftigen, professionell arbeitenden managed Server- oder Shared Hosting-Provider wird vernünftig gesichert und bei Bedarf auch wieder zurückgespielt.
Es liegt auch in deiner Verantwortung Sicherungen regelmäßig auf Funktionalität zu prüfen ggf. vielleicht noch zusätzlich eigene Sicherungen anzulegen um sich nicht nur auf das eine Sicherungsseil eines anderen zu verlassen.
Um deine Arbeit die da drin steckt ist es natürlich schade, Mitleid habe ich aber keins.

webhero wrote:Jetzt möchte ich das ganze lokal auf emienm Rechner (schneller) alles nochmal neu machen. Ich hoffe ihr habt was mein obiges Problem angeht gute Nachrichte.

Ich hoffe, du hast dich vorher ausreichend Informiert, ob Magento auf Apache 2.4 und PHP 5.4 überhaupt lauffähig ist.

Aus den Magento System Requirements lese ich zumindest heraus, dass Apache nur bis Version 2.2.X und PHP bis v5.3.15 unterstützt wird. Es steht dir natürlich frei es dennoch zu testen, vielleicht hast du ja Glück.

mit freundlichen Grüßen,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP für Windows

Who is online

Users browsing this forum: No registered users and 28 guests