Newbie PHP Help - Not Parsing

Alles, was PHP betrifft, kann hier besprochen werden.

Newbie PHP Help - Not Parsing

Postby jtobeck » 20. January 2014 03:35

Hi Apache Friends:

Thank You for XAMPP and all of the hard work you put into it.

I installed XAMPP 1.8.2 on a Windows 7 home professional 64 bit platform.
It works fine I was able to code PHP test files.

Because the system i plan to develop will be quite large, I did not want to use the standard c:\XAMPP\htdocs\ directory.
I created a c:\XAMPP Development\ directory to load my files.

I modified the Document root in httpd as follows:

DocumentRoot "C:/XAMPP Development"
<Directory "C:/XAMPP Development">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>

All of the straight HTML works fine, but all of the PHP is being ignored.

For example, if I put:
<?php
echo"hello world;
?>

in an HTML file it is silently ignored.
If I call a php file (via a form action=my.php.script" method=POST for example)

I generate a PHP syntax error at the first line of code.

For example :
<?php
$show_form=true;
... ?>

Generates
Parse error: syntax error, unexpected '$show_form' (T_VARIABLE) in C:\XAMPP Development\register.php on line 27

I am guessing I need to adjust another configuration parameter, but I am not sure what or where.

TIA
jtobeck
 
Posts: 3
Joined: 20. January 2014 03:02
Operating System: Windows 7 home premium 64 bit

Re: Newbie PHP Help - Not Parsing

Postby Altrea » 20. January 2014 04:00

Hi jtobeck,

jtobeck wrote:Because the system i plan to develop will be quite large, I did not want to use the standard c:\XAMPP\htdocs\ directory.

That is not a good reason.
You will always have the possibility to configure virtual host to define one or multiple domains with it's own document root.
That would be the recommend way.

jtobeck wrote:All of the straight HTML works fine, but all of the PHP is being ignored.

Which url does your browser show?

jtobeck wrote:For example, if I put:
<?php
echo"hello world;
?>

in an HTML file it is silently ignored.

Sure, .html files will not gets end through the php parser. Name it .php instead

jtobeck wrote:If I call a php file (via a form action=my.php.script" method=POST for example)

Is that form a html file? if yes, how do you request it?

jtobeck wrote:I generate a PHP syntax error at the first line of code.

For example :
<?php
$show_form=true;
... ?>

I don't see a syntax error in the first line of code.

jtobeck wrote:Generates
Parse error: syntax error, unexpected '$show_form' (T_VARIABLE) in C:\XAMPP Development\register.php on line 27

And what is line 26ff of your register.php?

jtobeck wrote:I am guessing I need to adjust another configuration parameter, but I am not sure what or where.

Commonly no, but we can not be sure because of lack of information.

best wishes,
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: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Newbie PHP Help - Not Parsing

Postby jtobeck » 20. January 2014 05:21

Thanks for your response Altrea.

You will always have the possibility to configure virtual host to define one or multiple domains with it's own document root.
That would be the recommend way.</bq>

Yes, I understand. It is more of a method of segregating source code so that I keep the original XAMPP distribution intact.

Which url does your browser show?

I am running through localhost on port 80.

Is that form a html file? if yes, how do you request it?

The form is an html file with a submit button. it is set up as:
Code: Select all
<form action="register.php" name="register" id="register" method="post">

So on submit the register.php file is called to process the form.

And what is line 26ff of your register.php?

All whitespace prior to that line. the exact syntax is:
Code: Select all
<?php
/*  comments and other white space */
require_once "scripts/formvalidator.php"

$show_form=true;
...
?>
jtobeck
 
Posts: 3
Joined: 20. January 2014 03:02
Operating System: Windows 7 home premium 64 bit

Re: Newbie PHP Help - Not Parsing

Postby Altrea » 20. January 2014 07:02

So the php error contains the correct information.
You are producing a syntax error in line 25 by omitting the semicolon which takes effect in line 27.
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: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Newbie PHP Help - Not Parsing

Postby jtobeck » 21. January 2014 02:49

ARGhhh!!!
I feel so stupid.

Thanks for taking the time to help me out.
jtobeck
 
Posts: 3
Joined: 20. January 2014 03:02
Operating System: Windows 7 home premium 64 bit


Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests