I just found out that my webhost discontinued PHP4, and even though everyone says PHP5 is backwards comaptible, I seem to have some PHP4 code that does not work anymore. I am hoping someone out there can tell me why? I am very new to PHP so I am not very good at figuring this out myself. The code snippet that doesn't work is below - if anyone can tell me if its easier to modify the code or just move to a web host that supports PHP4, I would much appreciate it!
PHP4 code doesn't work on PHP5 server
doesn't work
very vauge, how about giving us error messages or at least someting to go on.
As dagon points out, supplying us with the error messages (you've got a parse error, for example) would be a good idea.
One problem I noticed immediately was this code:
$str = "thisD";
print $str;
You can't have a random variable and/or statement in the middle of a class definition.
EDIT: That code also causes a parse error in PHP 4.
Sorry to be so vague about "doesn't work" - but I don't know how else to describe it becuase the page simply comes up blank: http://www.platopettreats.com/locator --
The page pulls up about 12 different PHP files & includes, and I tracked it down to the page that I linked (code linked above) as the place where it stops printing my $echo "here i am" messages.
Is there a way to get PHP to write the error perhaps to help with this discussion?
Oh and this is just my troubleshooting - the code breaks with or without this
$str = "thisD";
print $str;
kosborn wrote:Is there a way to get PHP to write the error perhaps to help with this discussion?
Yes, of course - that's what the [man]display_errors[/man] and [man]error_reporting[/man] PHP directives are for; change them either in the php.ini file itself, or in a .htaccess file (if you're using Apache and PHP is loaded as an ISAPI module rather than a CGI binary).
EDIT:
kosborn wrote:Oh and this is just my troubleshooting - the code breaks with or without this
With that "troubleshooting" code (which would more aptly be named "trouble-causing" code), the script contains a parse error. Without it, there are no parse errors.
I've put the below in my .htacces file in the root, but still no errors showing up on the main page when loaded:
http://www.platopettreats.com/locator/
this is in my .htaccess to try & see the errors
PHP error handling for development servers
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /home/path/public_html/domain/PHP_errors.log
[see footnote 3] # php_value error_reporting 999999999
php_value error_reporting -1
php_value log_errors_max_len 0
kosborn wrote:I've put the below in my .htacces file in the root, but still no errors showing up
If you do a phpinfo(), what does PHP report for the "Server API" ?
Does your host allow you to change PHP directives in a .htaccess file, or do they instead suggest you make the changes in a custom php.ini file placed at a certain location?
Are you not developing your site in local test/development environment? :p