Jump to content

heredoc <<<


abdelelbouhy

Recommended Posts

I don't think you shold have a space between the "<<<" and the identifier... try:

$string = <<<Endsome textsome textEnd;

Also, make sure that "End;" is indeed the first thing on that line - there shouldn't even be a space at that line.Last, but not least, see if you can somehow see the parsing errors from PHP.

Link to comment
Share on other sites

still not workingis there is anyway in php to turn on warnings or diagnosticsthat similar to perl and how to run a program from the command line in perl i just run in the command line but with php i got prombt to save or open whaen you click open it disappear

Link to comment
Share on other sites

500.0... sounds like IIS.... if you have direct access to your php.ini, you can set up "display_errors" to "Off", and set "log_errors" to "On", and set "error_log" to some path to a file where the errors will be written to. You can the view the file to pinpoint the cause of the error.

Link to comment
Share on other sites

still not workingis there is anyway in php to turn on warnings or diagnosticsthat similar to perl
Stick this at the very top of your PHP script:// Report all PHP errors error_reporting(E_ALL);More info: http://php.net/manual/en/function.error-reporting.php
Link to comment
Share on other sites

how to run a program from the command line
From the shell, type: php -f name_of_script.phpYou may need to add the path to PHP (and the path to your script if you're not already in the same directory as the script).More info: http://php.net/manual/en/features.commandline.php
Link to comment
Share on other sites

error_reporting and ini_set will not execute if there is a parsing error, which is what 500 errors usually turn out to be. They could be turned on in a php.ini file, however, as long as you don't mind having error reporting on all the time.As an alternative, you can create a file called test.php . In this file, turn on error reporting and display errors (as shown above). In the next line, include the file you are having trouble with. E.g.:

<?php   error_reporting(E_ALL);   ini_set('display_errors', 1);   include my_file.php;?>

That's the whole script. The error reporting will get switched on because the test file has no errors. Now you will get a report of any parsing errors in the included file. It takes a few minutes to set up, but it's better than having errors reported live on your enterprise server (assuming you use that to develop with also). It's also handy to keep around ready to use. Just change the name of the target file.Props to JSG.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...