php code word op enkele pagina's omgezet naar comment

Pagina: 1
Acties:

Onderwerpen

Vraag


Acties:
  • 0 Henk 'm!

  • ard1998
  • Registratie: December 2015
  • Laatst online: 09-06 19:59
Sinds vandaag heb ik mijn server draaien op ubuntu 16.04 (clean install) maar op deze installatie word op enkele pagina's de php code in html weergeven als een comment. overgens werkte alles normaal op 16.10.


een voorbeeld
Syntax:
PHP: main.php
1
2
3
4
 for <?php include "top.php" ?>
<h1>agenda project</h1>

<?php include "bottom.php" ?> 

word alsvolgt weergeven

Syntax:
HTML: filename
1
2
3
4
5
6
7
8
9
10
<html>
<head>
</head>
<body>
<!--?php include "top.php" ?-->
<h1>agenda project</h1>

<!--?php include "bottom.php" ?-->
</body>
</html>






Relevante software en hardware die ik gebruik


hardware
Dell 7559


OS
ubuntu mate 16.04.1 (net alle updates geinstalleerd


apache
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26


php
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )







Wat ik al gevonden of geprobeerd heb
-OS opnieuw installeren
-apache en php opnieuw installeren
-verschillende php modules geinstalleerd en verwijderd

alvast bedankt voor de hulp :)

Beste antwoord (via ard1998 op 02-11-2016 07:10)


  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
http://stackoverflow.com/...onverted-to-html-comments
The place to correctly configure PHP operation is the httpd.conf file, which resides in the conf subdirectory of your Apache installation directory.

In there, you'll want to look for the module loading section, which will be a bunch of lines that start with LoadModule. Somewhere in there, you should have the following (or something very similar):
LoadModule php5_module "location\of\your\php\installation"
AddType application/x-httpd-php .php
PHPIniDir "location\of\your\php\configuration\file"

I'm not all too familiar with Linux, but in Windows (WAMP) installations, those would be something along the lines of:
LoadModule php5_module "c:/program files/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/program files/php"

And the httpd.conf file, on my machine, is at C:\Program Files\Apache Group\Apache2\conf\httpd.conf.

It could also be that PHP is simply not installed at all on your machine, in which case, you will have to download it and install it. Brad's already posted the relevant link in one of his comments, (+1, by the way, Brad), but for the sake of having everything in one spot:

PHP: Installation and Configuration - Manual
Verder ook vrij relevant op die pagina:
Your Chrome is lying to you.

Your PHP source file is <?php echo 'test'; ?>. Because PHP is not executed, this file is sent to the browser. If the browser should interpret this text, it will stumble upon the <? ?> marks. They have a meaning - they are "XML processing instructions", and the text after the opening angle defines the target.

Obviously the browser does not know about a target named "PHP", so this text is ignored.

And then the element inspector tries to display the DOM and is lying about the original source code, because he is working on the PARSED source - which is great because you usually want to know on which data the browser acts, and this includes how the browser interpreted your source.

But if you make any error, the browser will try to fix it, and the fix is included in the element inspector.

Obviously the fix for an unknown XML processing instruction is to disable it by commenting it out.
Conclusie uit die laatste: Niet de inspector gebruiken maar gewoon CTRL-U (of rechtsklik -> view source) doen.

Overigens: als het "enkele pagina's" omvat zoals in je topictitel dan: wat is het verschil tussen die pagina's? Bestandsextensie?

[ Voor 118% gewijzigd door RobIII op 02-11-2016 02:30 ]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij

Alle reacties


Acties:
  • Beste antwoord
  • 0 Henk 'm!

  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
http://stackoverflow.com/...onverted-to-html-comments
The place to correctly configure PHP operation is the httpd.conf file, which resides in the conf subdirectory of your Apache installation directory.

In there, you'll want to look for the module loading section, which will be a bunch of lines that start with LoadModule. Somewhere in there, you should have the following (or something very similar):
LoadModule php5_module "location\of\your\php\installation"
AddType application/x-httpd-php .php
PHPIniDir "location\of\your\php\configuration\file"

I'm not all too familiar with Linux, but in Windows (WAMP) installations, those would be something along the lines of:
LoadModule php5_module "c:/program files/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/program files/php"

And the httpd.conf file, on my machine, is at C:\Program Files\Apache Group\Apache2\conf\httpd.conf.

It could also be that PHP is simply not installed at all on your machine, in which case, you will have to download it and install it. Brad's already posted the relevant link in one of his comments, (+1, by the way, Brad), but for the sake of having everything in one spot:

PHP: Installation and Configuration - Manual
Verder ook vrij relevant op die pagina:
Your Chrome is lying to you.

Your PHP source file is <?php echo 'test'; ?>. Because PHP is not executed, this file is sent to the browser. If the browser should interpret this text, it will stumble upon the <? ?> marks. They have a meaning - they are "XML processing instructions", and the text after the opening angle defines the target.

Obviously the browser does not know about a target named "PHP", so this text is ignored.

And then the element inspector tries to display the DOM and is lying about the original source code, because he is working on the PARSED source - which is great because you usually want to know on which data the browser acts, and this includes how the browser interpreted your source.

But if you make any error, the browser will try to fix it, and the fix is included in the element inspector.

Obviously the fix for an unknown XML processing instruction is to disable it by commenting it out.
Conclusie uit die laatste: Niet de inspector gebruiken maar gewoon CTRL-U (of rechtsklik -> view source) doen.

Overigens: als het "enkele pagina's" omvat zoals in je topictitel dan: wat is het verschil tussen die pagina's? Bestandsextensie?

[ Voor 118% gewijzigd door RobIII op 02-11-2016 02:30 ]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij


Acties:
  • 0 Henk 'm!

  • mcDavid
  • Registratie: April 2008
  • Laatst online: 12:22
als je webserver stack gewoon installeert met apt install lamp-server^ staat alles automatisch goed geconfigureerd.

Acties:
  • 0 Henk 'm!

  • ard1998
  • Registratie: December 2015
  • Laatst online: 09-06 19:59
RobIII schreef op dinsdag 01 november 2016 @ 23:10:
http://stackoverflow.com/...onverted-to-html-comments


[...]


Verder ook vrij relevant op die pagina:


[...]

Conclusie uit die laatste: Niet de inspector gebruiken maar gewoon CTRL-U (of rechtsklik -> view source) doen.

Overigens: als het "enkele pagina's" omvat zoals in je topictitel dan: wat is het verschil tussen die pagina's? Bestandsextensie?
er zit geen verschil in, allemaal php bestanden. ik heb voor de zekerheid de installatie instructies nog een keer doorlopen en nu werkt het weer.

Acties:
  • 0 Henk 'm!

  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
ard1998 schreef op woensdag 02 november 2016 @ 07:19:
[...]


er zit geen verschil in, allemaal php bestanden. ik heb voor de zekerheid de installatie instructies nog een keer doorlopen en nu werkt het weer.
En wat heb je gewijzigd dan / waar zat het in? Wel zo handig voor iemand anders die hier ooit nog op dit topic stuit... (https://xkcd.com/979/)

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij


Acties:
  • 0 Henk 'm!

  • ard1998
  • Registratie: December 2015
  • Laatst online: 09-06 19:59
De tweede quote liet me weten dat er iets niet geistalleerd was, dus ik heb alle apt-get install regels van https://www.digitalocean....amp-stack-on-ubuntu-16-04 (waarnodig met --reinstall) uitgevoerd en het systeem gereboot. Hierna werd de PHP paina weer correct weergeven.
Pagina: 1