Help pls: Not processing PHP now, was previously

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Help pls: Not processing PHP now, was previously

Postby spr21hear » 05. August 2021 17:15

Dear experts...Afraid that I'm posting a query that's been posted before, as recently as June; but, there, the "conversation" stopped, with no advice that I can use for my case. If someone would be so kind to help...
HERE: Xampp running fine for YEARS! WITH no problems --- All my code includes html and php, plus a bit of javascript. All my file names end with ".php" to ensure that the php "component" of xampp will "function". OK: So, just YESTERDAY, THE SITUATION CHANGED: only one small php line (of code) is being processed, but incorrectly! - It is an "if" statement", and it is NOT running correctly (wrong condition). All html and javascript code are "running" OK (on the "bright side").
This is the case with ALL my files; yes, I've ran them all, just to confirm the situation.
--- NO, I did not change ANYTHING in these files, so to cause this change in the behavior of xampp FOR ALL FILES.
--- Since yesterday, I've rechecked all files for any coding errors I might have missed, but NO: I didn't find anything that would trigger this malfunction that is occurring FOR ALL FILES - that's already the "tip-off" that implies that it IS (?) a problem with xampp, not with my code.
Xampp version: x64...7.1.30-3-vc14 . I run via "localhost/ ..." , as always (no problems).
--- Has it been corrupted, and I need to reinstall?
--- Tearing my hair out! :(( --- help!
In advance, THANK YOU so much for any advice!!!
spr21hear
 
Posts: 8
Joined: 17. April 2021 17:39
XAMPP version: 3.2.4
Operating System: windows7

Re: Help pls: Not processing PHP now, was previously

Postby Nobbie » 05. August 2021 19:31

In order to apply any help, we need to see the source code of your PHP scripts and we have to know,what exactly you are trying to do. Currently we dont know nothing, that is BY FAR not enough.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: Help pls: Not processing PHP now, was previously

Postby Altrea » 05. August 2021 20:53

We need the contents of the Apache error.log, php_error_log and the php code itself in order to being able to analyze this sort of issue.
Maybe even the copied code of the php file is not enough, so that we need the original file, but we request it later if needed.

wild guess into the blue without any evidence: any type of character encoding issue that can make the php interpreter unable to process characters correctly like the start and ending php tags <?php and ?>
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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Help pls: Not processing PHP now, was previously

Postby spr21hear » 05. August 2021 21:57

THANK YOU, GUYS!!!
...After much thrashing about in test modules, I'd found MY error: I didn't have "==", but single = , in my php - IF statement. This caused the php interpreter to "wobble", shall I say, and so caused my problem: mis-interpretation of the IF statement, that related to a previous definitive "x = something" statement.
(btw, this was an interesting "error" by the interpreter; I wouldn't have thought there was a "difference" between "==" and "=" to cause a "mini-crash" )

Altrea - THANKS very much for your thoughtful wild guess, bc that was my 1st guess also, but these were all OK, in my code.
--- Nevertheless - THANK YOU BOTH, guys - to attempt to aid my cries for help!
You guys are the BEST (and I couldn't have done what I wanted without XAMPP- YAY!), as I've asked for, and received great advice, during my (endless) coding nightmare.
THANK YOU, and have a great evening/day ! :))
spr21hear
 
Posts: 8
Joined: 17. April 2021 17:39
XAMPP version: 3.2.4
Operating System: windows7

Re: Help pls: Not processing PHP now, was previously

Postby Altrea » 05. August 2021 22:37

Glad you got this working.

But then i don't understand your explainations from your initial post:
Xampp running fine for YEARS! WITH no problems
[...]
just YESTERDAY, THE SITUATION CHANGED:
[...]
This is the case with ALL my files;
[...]
NO, I did not change ANYTHING in these files, so to cause this change in the behavior of xampp FOR ALL FILES.

Does that mean the single = in your if statements was placed without you doing anything?

btw: please stop switching to CAPS ONLY writing. This only made your text more difficult to read.
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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Help pls: Not processing PHP now, was previously

Postby spr21hear » 06. August 2021 14:03

Hi again...Overnight, I'd pondered this strange situation...Recap: This php "mis-interpretation" started 2 days ago. Up to this time, my IF statements had either = or ==, randomly (I'm not a "perfect" coder/robot, obviously) - These ran perfectly before 2 days ago. So, forward to last night: in my test modules, out of desperation, I changed to ==, consistently, and then the IF statements were correctly interpreted; modules ran perfectly. And, I just re-ran these tests again now, to double-check these findings - This problem persists, and the only solution, if I can call it that, is to have == consistently, in my IF statements.
--- I don't know what to say: What happened to my xampp 2 days ago; how can my static program "change"? --- has it been corrupted?
Thank you again, for your continued patience, assistance and analysis of my problem; I'm "stumped".
:))
spr21hear
 
Posts: 8
Joined: 17. April 2021 17:39
XAMPP version: 3.2.4
Operating System: windows7

Re: Help pls: Not processing PHP now, was previously

Postby Nobbie » 06. August 2021 17:05

spr21hear wrote:--- I don't know what to say: What happened to my xampp 2 days ago; how can my static program "change"? --- has it been corrupted?


I dont think so, actually i think the code has not been changed anyway. But as a matter of fact, there are situations where "=" actually works instead of "==". As PHP evaluates the whole assignment (a singe "=" is an assignment) and the assignment may be evaluated like the value of the assignment.

For ease of understanding, i give you an example:

Code: Select all
<?php

      $x = 5;

      if ($x = 5)
         echo "Value of x is 5, as x is $x";
?>


This will run perfectly fine if you run it thru the PHP interpreter. Because the assignment in the if-Statement is evaluated as 5 and 5 means TRUE in a boolean manner. Now lets change it slightly:

Code: Select all
<?php

      $x = 3;

      if ($x = 5)
         echo "Value of x is 5, as x is $x";
?>


If you run this script, it will also say "Value of x is 5, as x is 5". But that is not, what you would expect, as you assigned 3 to $x. But you overwrote that assignment by the assignment in the if. Now lets correct our code:

Code: Select all
<?php

      $x = 3;

      if ($x == 5)
         echo "Value of x is 5, as x is $x";

     echo "The value of x is $x";
?>


Now the first echo (in the if) wont be executed, as $x is 3 and that is not equal to 5. This script will simply say "The value of x is 3".

Thats how PHP handles assignments in if-clauses. I think, PHP even does not give a warning, as the code basically is correct syntax. In many scripts you will find if-clauses like this:

Code: Select all
<?php
   
      if ($fd = fopen("myfile.txt", "r"))
         echo "File myfile.txt successfully opened.";

?>


This is basically correct code, the fopen() will try to open a file for reading, if succesfull, it will return a non-zero value to $fd (which then is assigned to $fd) and the whole boolean value of this assignment is non-zero, so its TRUE. Very common practive.

And i think, that you did not change your code, but for whatever reason there may be a change to the values of the assigned variables. That results in unexpected behaviour finally.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: Help pls: Not processing PHP now, was previously

Postby spr21hear » 06. August 2021 20:48

Althea, thank you very much! -- I didn't realize that the if-statement in itself was an assignment; this is illuminating! (have copied your response for my notes/records)
However, as a parting note, its interesting that I received my "expected" results for such a long time, and then, abruptly, the alternate interpretation "takes over" (and may persist from this time on)... ummm. The comforting thought is that changing to all == does not affect my logic/calcuiations anyway (simple if-statements, thankfully), so I'll proceed with this plan, to ensure subsequent desired & expected(!) results. ( --- I'm so relieved that I can continue work, and using xampp :)) )
Thank you very much for your time and patience...have a fabulous evening and weekend!
spr21hear
 
Posts: 8
Joined: 17. April 2021 17:39
XAMPP version: 3.2.4
Operating System: windows7

Re: Help pls: Not processing PHP now, was previously

Postby Nobbie » 06. August 2021 21:06

spr21hear wrote:Althea, thank you very much! -- I didn't realize that the if-statement in itself was an assignment; this is illuminating! (have copied your response for my notes/records)


My name is "Nobbie". Not "Althea".
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: Help pls: Not processing PHP now, was previously

Postby spr21hear » 07. August 2021 12:10

Ooops - so sorry! I thought Althea was continuing his thread --- thanks soo much, Nobbie! -- I really appreciate your time and patience with my inquiry; you have provided much relief !!! (want to use caps, but I believe you guys prefer lower-case)
Thank you sooo much, and have a great weekend !!! :))
spr21hear
 
Posts: 8
Joined: 17. April 2021 17:39
XAMPP version: 3.2.4
Operating System: windows7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 165 guests