Apache versteht nur <?php - brauche aber <? - Wie?
Apache versteht nur <?php - brauche aber <? - Wie?
Hallo Zusammen,
ich habe ein Problem. Ich habe meinen Apache auf 2.2 geupdatet. Wenn ich jetzt eine Datei mit .php aufrufe in der der PHP Code mittels "<?" anfängt bekomme ich auf der Seite nur Quelltext angezeigt.
Wenn ich es mit "<?php" mache, funktioniert es einwandfrei.
Wie kann ich Apache jetzt sagen, das er auch "<?" akzeptieren soll?
Danke im voraus.
ich habe ein Problem. Ich habe meinen Apache auf 2.2 geupdatet. Wenn ich jetzt eine Datei mit .php aufrufe in der der PHP Code mittels "<?" anfängt bekomme ich auf der Seite nur Quelltext angezeigt.
Wenn ich es mit "<?php" mache, funktioniert es einwandfrei.
Wie kann ich Apache jetzt sagen, das er auch "<?" akzeptieren soll?
Danke im voraus.
-
der kleine tux
- Posts: 97
- Joined: 2005-10-29 04:12
- Location: Planet Erde
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Hi
das sollte es sein
zu finden in deiner php.ini
gruss
das sollte es sein
Code: Select all
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = On
gruss
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Der short_open_tag sollte abgeschafft werden. Zum einen verleitet er nur zum unsauberen Programmieren und zum anderen hat man Probleme mit .php Dateien, die XHTML erzeugen sollen (wenn das <?xml nich mit PHP sondern nativ notiert wird).
Was ist eigentlich das Problem es RICHTIG zu machen, also mit "<?php" als öffnendes Tag? Wenn es nicht Dein Script ist einfach mit suchen und ersetzen anpassen. Hab das mit Visas auch mal gemacht. Jetzt läuft es auch mit "short_open_tag = off".
[TOM]
Was ist eigentlich das Problem es RICHTIG zu machen, also mit "<?php" als öffnendes Tag? Wenn es nicht Dein Script ist einfach mit suchen und ersetzen anpassen. Hab das mit Visas auch mal gemacht. Jetzt läuft es auch mit "short_open_tag = off".
[TOM]
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Hab das mal gemacht als script. Bei mir hat ein einfaches
for i in *; do sed -e "s/<? /<?php /g" $i > $i.new; mv $i.new $i; done
geholfen.
Wer nicht weiss was er tut sollte das Script besser nicht verwenden!
for i in *; do sed -e "s/<? /<?php /g" $i > $i.new; mv $i.new $i; done
geholfen.
Wer nicht weiss was er tut sollte das Script besser nicht verwenden!
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Ungetestet:
Code: Select all
find . -type f -name *.php -print0 | xargs -0 sed 's/<?([[:space:]].*)*$/<?php1/g' -i -PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Apache versteht nur <?php - brauche aber <? - Wie?
ich fand meins besser, da kann man erstmal einen Probelauf machen und das mv weglassen ;)
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Was nützt mir ein Probelauf, wenn die Escapes falsch sind ;)
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Was soll den falsch sein? Ich seh im Moment keinen Fehler :(
Re: Apache versteht nur <?php - brauche aber <? - Wie?
braindead wrote:for i in *; do sed -e "s/<? /<?php /g" $i > $i.new; mv $i.new $i; done
Re: Apache versteht nur <?php - brauche aber <? - Wie?
Meine Version checkt ob nach dem <? ein Freizeichen vorhanden ist und baut das dann auch nach dem <?php wieder an der Stelle ein. Nach meiner Meinung völlig richtig. Korrigiert mich wenn ich falsch liege.
Re: Apache versteht nur <?php - brauche aber <? - Wie?
OK, dank fehlender Code-Tags habe ich die Leerzeichen übersehen :roll:
Aber: Was macht Deine Version, wenn nach dem <? kein (Leer)zeichen oder ein Tab vorkommt?
Aber: Was macht Deine Version, wenn nach dem <? kein (Leer)zeichen oder ein Tab vorkommt?
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Apache versteht nur <?php - brauche aber <? - Wie?
OK ... da passiert dann mal garnix. Bisher war ich der meinung das php das garnet akzepiert wenn nach den Opentags nix stehen, aber ich musste mich soeben eines besseren belehren lassen :( Das macht die Sache dann aber mal echt kompliziert. Ich denke das wird ohne ein awk script kaum zu lösen sein. Deine Version hat mit dem Fehlenden Leerzeichen aber auch Probleme ...
aus:
wird:
auch net so das ware ;) Hab gerade keine zeit was besseres zu basteln, ich mach mich nachher mal schnell dran und bau was.
aus:
Code: Select all
<?echo "test"; ?>Code: Select all
<?echo<?php "test"; ?>Re: Apache versteht nur <?php - brauche aber <? - Wie?
Code: Select all
find . -type f -name *.php -print0 | xargs -0 sed 's/<?([[:print:]].*)*$/<?php1/g' -i -PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
