Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Different results for date routine on web compared to local

JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Different results for date routine on web compared to local

Unread post by JohnKlassen »

Hi,

I created a procedure to test how dates are displayed when I start with a format of mm/dd/yyyy and use 'reformat'. Here is the code:

Code: Select all

 echo "date format when using reformat";
 echo "<br>\n"; 

 print "from date without reformat is ".'#vFrom#';

 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 6);
 print "from date with reformat 6 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 7);
 print "from date with reformat 7 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 8);
 print "from date with reformat 8 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 9);
 print "from date with reformat 9 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 10);
 print "from date with reformat 10 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 11);
 print "from date with reformat 11 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 12);
 print "from date with reformat 12 is ".$fromdate;
 echo "<br>\n"; 

 $fromdate = reformatField('#vFrom#', 13);
 print "from date with reformat 13 is ".$fromdate;
 echo "<br>\n"; 
When I run this procedure and enter a date of '01-16-2013' into the form using localhost, I get the following output:
date format when using reformat
from date without reformat is 01-16-2013
from date with reformat 6 is '2013--01'
from date with reformat 7 is '2013-16-01'
from date with reformat 8 is '2013--6-'
from date with reformat 9 is '2013-01-16'
from date with reformat 10 is '2013--01'
from date with reformat 11 is '2013-16-01'
from date with reformat 12 is '2013--6-'
from date with reformat 13 is '2013-01-16'
When I run the same procedure on the web site, I get the following:
date format when using reformat
from date without reformat is
from date with reformat 6 is NULL
from date with reformat 7 is NULL
from date with reformat 8 is NULL
from date with reformat 9 is NULL
from date with reformat 10 is NULL
from date with reformat 11 is NULL
from date with reformat 12 is NULL
from date with reformat 13 is NULL
At first I thought it was a problem with magic quotes on the web site so I turned magic quotes off and verified that they are off:
[magic_quotes_gpc] => Array
(
[global_value] =>
[local_value] =>
[access] => 6
)

[magic_quotes_runtime] => Array
(
[global_value] =>
[local_value] =>
[access] => 7
)

[magic_quotes_sybase] => Array
(
[global_value] =>
[local_value] =>
[access] => 7
)
Is there another place where the date format could be affected on the web site?

Thanks,

John
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: Different results for date routine on web compared to lo

Unread post by shane »

Hi,

sorry, but I have tried your code on two different hosting locations and I have not been able to re-produce your error.
JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Re: Different results for date routine on web compared to lo

Unread post by JohnKlassen »

Hi,

I have been working on other parts of my project for the last few months. Finally this problem has become my highest property. Since my original description of this problem, I have learned a few things and would like to describe the issue again.

I have created a form called, "Select Unit and Dates" that looks like this:
Unit - Date form
Unit - Date form
Unit - Date Form.png (4.26 KiB) Viewed 18240 times


I call this form from a procedure with the following code:

Code: Select all

var_dump($formValue);

// Get unit from form
 echo "<br>\n"; 
 echo "<br>\n"; 
print "unit # is ".'#vUnit#';

 echo "<br>\n"; 

// Get date range from form

print "from date is ".'#vFrom#';
 echo "<br>\n"; 

print "to date is ".'#vTo#';
 echo "<br>\n"; 
When I run the procedure and enter in the 'unit number' and 'from date', leaving the 'to date' in the form, it works fine on my laptop. I get the following results:
array
'id' => string '151c76420e000e' (length=14)
'recordID' => string '151c76420e000e' (length=14)
'vFrom' => string '01-01-2013' (length=10)
'vTo' => string '08-05-2013' (length=10)
'vUnit' => string '01-102' (length=6)

unit # is 01-102
from date is 01-01-2013
to date is 08-05-2013
When I run the procedure on GoDaddy's web site (my client's service provider), I get the following:
array(5) { ["id"]=> string(14) "151c76420e000e" ["recordID"]=> string(14) "151c76420e000e" ["vFrom"]=> string(0) "" ["vTo"]=> string(10) "08-05-2013" ["vUnit"]=> string(0) "" }

unit # is
from date is
to date is 08-05-2013
As you can see, the procedure works fine on my laptop, but when I run it on GoDaddy, only the 'to date', which is the 'current date' works.

When I wrote the original description of the problem, I thought the problem was related just to a 'date' routine. Now I see it also doesn't work for 'unit'. Both the laptop and GoDaddy seem to respond differently to the '$formvalue' variable.

Is it possible that there is a php.ini variable that I need to define in GoDaddy to get this routine to work?

Are there other debugging tools like, "var_dump($formValue);" that would be helpful in determining what is causing this discrepancy?

Thanks,

John
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Different results for date routine on web compared to lo

Unread post by massiws »

John, sorry but I'm not able to give a reply.
Some suggestions:
  • does the server provides sufficient resources to nubuilder?

    Code: Select all

    short_open_tag = On
    max_input_vars = 5000
    max_execution_time = 600
    variables_order = "EGPCS"
    post_max_size = 16M
    magic_quotes_gpc = Off
  • have you set the date.timezone in php.ini file?
  • have a look inside this tread;
  • have you tried to upload again DB to GoDaddy's server?
I tried your code on my local server with PHP 5.4 and on another server with PHP 5.3 and both works fine.

Max
JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Re: Different results for date routine on web compared to lo

Unread post by JohnKlassen »

Max,

Thanks for responding to my request for help. Unfortunately none of your suggestions helped make it work.

First of all, I can re-produce this problem with just 1 line of code and 'var_dump ($formValue)' to show it doesn't work:

Code: Select all

var_dump($formValue);
print "unit # is ".'#vUnit#';
I am assuming that the GoDaddy web server can't handle $formValue. On the other hand, if you look at the results of running the procedure as shown above and copied here:
array(5) { ["id"]=> string(14) "151c76420e000e" ["recordID"]=> string(14) "151c76420e000e" ["vFrom"]=> string(0) "" ["vTo"]=> string(10) "08-05-2013" ["vUnit"]=> string(0) "" }

unit # is
from date is
to date is 08-05-2013
you will see that "vTo" does return a value. The difference between "vFrom" and "vTo" is that "vTo" is populated by the "Default Value SQL" of "SELECT CURDATE()". I just tried to change the "vTo" date by typing over the current date and also by selecting a different date from the calendar. In both cases ''var_dump ($formValue)' returned the current date instead of the updated date. I am not sure what that tells you.

Let me respond to the rest of your suggestions:
- First of all my laptop is running PHP 5.3.5 and GoDaddy web site is 5.3
- I modified the php5.ini file on the web site with your suggestions and even increased "post_max_size" to 512M with no change to the results.
- I did not change date.timezone in php.ini because even the 'unit' formValue does not work.
- I have copied the entire DB between my laptop and the we site and back to my laptop many times and I see no change with this procedure.
- I called GoDaddy web site tech support and they said they didn't see any problems with my php.ini file
- I read thru the thread you suggested but I was not sure what I would change after reading it. I don't get an 'internal server error'. I am not using any SQL statements. I did look at the code at the very end and didn't know whether I needed to add the version check code since I am running 5.3.5 and GoDaddy is running 5.3.
- I was curious about the log file shown in that thread and whether that is something I can generate and if so how.

I am open to any other suggestions you may have. GoDaddy tech support is saying that they can't do anything else.

Let me know if you want a copy of the php5.ini file from the GoDaddy web site.

Thanks,

John
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Different results for date routine on web compared to lo

Unread post by massiws »

John,
JohnKlassen wrote:I modified the php5.ini file on the web site with your suggestions and even increased "post_max_size" to 512M with no change to the results.
Are you sure you modified the right file? Are you sure the changes have been applied (post_max_size value should be 16M, memory_limit should be 512M)?
Try to upload a file phpinfo.php in your server's root:

Code: Select all

// @file phpinfo.php

<?php
  echo phpinfo();
?>
Now point your browser in yoursite.com/phpinfo.php.
In the first rows of the table you can find Loaded Configuration File, that is the position on GoDaddy's server where you can find the php.ini file.
In that file you must modify the PHP values according to nuBuilder requirements (see my previous post).
Make sure that the changes have been applied (reload the page in browser).

If you can't modify some parameters, you must modify the htaccess file in your server's root (see this post).
JohnKlassen wrote:I was curious about the log file shown in that thread and whether that is something I can generate and if so how.
You can find the error_log file inside nuBuilder folder.

Hope this helps,
Max
JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Re: Different results for date routine on web compared to lo

Unread post by JohnKlassen »

Max,

I ran 'phpinfo.php' and verified that my application on the GoDaddy website is using the correct 'php.ini' and includes the changes you recommended. Actually GoDaddy uses 'php5.ini' instead of 'php.ini'. When I make changes to this file, all I have to do is rename 'php5,ini' to another name and back to 'php5.ini' to have php use the updated configuration file.

I was able to find 'error.log' on my laptop in 'NuBuilder\UwAmp\bin' but could not find any error log in my application on the web site.

I have used 2 different scripts to try to compare the php configuration parameters. The first is phpino.php. I found another script that writes all of the php configuration values to a text file. When I run the second script, I can save the output from the script in 2 different text files (one from laptop and one from the web site) and then compare the 2 files using WinMerge. The script is as follows:

Code: Select all

<?php
echo "<pre>";
print_r(ini_get_all());
echo "</pre>";
?>
The problem with comparing the 2 files, is that there are many differences between the laptop version and the web version and I am not sure which parameters are significant. What might be easier is to compare the php configuration between my web site and another web site. Did you test my code on a localhost or on a web server? If it was on a web server, would you consider sending me the output from phpinfo.php or using the utility above?

You can email it to me at john@johnklassen.com

Thanks,

John
JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Re: Different results for date routine on web compared to lo

Unread post by JohnKlassen »

Max,

I just realized I had the wrong path for the 'error.log'. It is in C:\NuBuilder\UwAmp\bin\apache\logs.

John
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Different results for date routine on web compared to lo

Unread post by massiws »

John, I tested your code both in my local machine and on a web server and in both cases it works.
Here is my phpinfo (scroll down to see the ini_get_all() output).
JohnKlassen
Posts: 148
Joined: Wed Dec 05, 2012 4:56 am

Re: Different results for date routine on web compared to lo

Unread post by JohnKlassen »

Max,

Using phpinfo I compared the values of the PHP parameters looking for what was different between php.ini on my laptop, GoDaddy website and your web site. After reviewing what values my laptop and your web site had in common that were different GoDaddy, I made the following entries in php5.ini in GoDaddy:
register_globals = off
allow_url_fopen = on
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
short_open_tag = On
max_input_vars = 5000
max_execution_time = 600
memory_limit = 512M

expose_php = Off
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

; The following php.ini parameters have been added to see if they fix the pop-up problem with the violations application
display_startup_errors = On
enable_dl = On
error_log = error_log
error_reporting = 22519
log_errors = On
max_input_time = 600
post_max_size = 32M
Despite making the above changes and verifying the changes, I still have the same problem.

The only parameter that I noticed that was different between GoDaddy and my laptop and your web site is that the Godaddy web site has _SERVER["HTTP_CONNECTION"] = 'close' while my laptop and your web site has it = 'Keep-Alive'.

I understand the above parameter is an 'Apache' variable rather than a PHP variable. It cannot be changed through php.ini.

Do you think that this parameter is relevant? If not, do you have any other suggestions?

Thanks,

John
Locked