Will Apache/PHP build affect how my PHP is parsed?

#1

Sorry if my question is vague…
I recently requested help about adding some PHP code to a form on my site like this…

[php][/php]

(My post is here: http://www.phphelp.com/forum/general-php-help/trying-to-echo-cookie-inside-of-form-code)

Everything was working fine until I migrated all of my sites to a new VPS/WHM server.
For some reason my code is no longer working.

The only thing I can think of is whether or not a different Apache/PHP build may have affected the PHP in some way.
When moving to the new host I asked them which Apache profile was the most secure and I installed it.

Could it be possible that something is preventing the code from being parsed?

#2

Place this function on a test page on each server and then compare the settings on both. You can place two browsers side
by side and compare them all… You might find something that way.

[php] phpinfo();[/php]

Just that one line on a blank page without any HTML should be enough… Let us know which sections are different.
By the way, I have never seen an HTML hidden field fail completely. Another thing you might want to do is is to look at the
source code AFTER PHP has rendered it’s version. Just go to the page that is failing and RIGHT-CLICK on it and VIEW-SOURCE and you can look at the area where the hidden field is and see if it is well formed. Perhaps it is not getting
the correct data…

#3

Thanks for your reply ErnieAlex,

Unfortunately I can’t compare the phpinfo files because I closed the previous hosting account…
…but…Strange things are happening as it now works…

Basically I viewed the source code and the output was…
[php]<input type=“hidden” name=“listname” value="<?php echo $_GET['id']; ?>[/php]

So it was basically being read as just characters.

I then installed a plugin (PHP Code For Posts) which I use on other sites.
I thought that if I added a code snippet with this…
[php]<?php echo $_GET['id']; ?>[/php]
…and just output it on the page via a shortcode, I could at least test to see if the PHP was working which it was.
I then checked the HTML source code again and noticed that the form was working.

Are Wordpress pages always PHP by default?
I recently updated my Optimizepress plugin (which is where I built the opt in form).
I wonder if it was a plugin problem where the PHP was being excluded from the form editor.

#4

Well, WP is a content management system built in PHP to allow users to have a back-end site that monitors and manages
the front-end website that the users access. It was originally created to allow site owners add sales items and display items
dynamically behind the scenes. Once updated, the users of the site see the items updated immediately. Then, plug-in’s were
created to fill in holes in the system for various needs.

The one issue with WP is that plug-in’s are made by a lot of different companies and individuals and you have to be careful
where you get them from. When you said you looked at the source code and then showed a line from it, that was the real
source code, not what is displayed on the site’s page. PHP is handled in the server only. It is never shown to the user of the
website. If you look at the page in question, and view the source of the live page, you will see what your code is placing into
the hidden field. If the data is incorrect, you have to track down where the error is. The code you showed is just the hex
version of $_GET[‘id’]; So that means that this data was placed there from the posted data in the URL.

It’s odd that it started working all of a sudden. Are you using PHP 5+ or the new 7?

#5

I’m using PHP 5.5.37

When the source code was spitting out the hex version, my URL was displaying as I wanted it to…
…mysite.com/?id=awlist123456

Now that it is working, it is displaying correctly in the source code…
[php] <input type=“hidden” name=“listname” value="awlist123456[/php]
and the opt in process is successful.

I wonder if my form editor (Optimizepress plugin) recent update has a bug of some sort.
I will mention it to the developers just in case…

#6

I also use PHP 5.5 on my main site. Well, at least it is working now. Most likely it was your update…