abdelelbouhy Posted July 25, 2010 Share Posted July 25, 2010 helloi'm trying the <<< for multiline string like this one$string = <<< Endsome textsome textEnd;but it generate an error(500.0 server internal error)souldn't be working Link to comment Share on other sites More sharing options...
boen_robot Posted July 25, 2010 Share Posted July 25, 2010 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 More sharing options...
abdelelbouhy Posted July 25, 2010 Author Share Posted July 25, 2010 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 More sharing options...
boen_robot Posted July 25, 2010 Share Posted July 25, 2010 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 More sharing options...
End User Posted July 25, 2010 Share Posted July 25, 2010 still not workingis there is anyway in php to turn on warnings or diagnosticsthat similar to perlStick 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 More sharing options...
End User Posted July 25, 2010 Share Posted July 25, 2010 how to run a program from the command lineFrom 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 More sharing options...
wirehopper Posted July 25, 2010 Share Posted July 25, 2010 ini_set('display_errors', 1);http://www.php.net/manual/en/function.ini-set.phphttp://www.php.net/manual/en/errorfunc.con....display-errors <?php$string=<<<Endsome textsome textEnd;echo $string;?> Link to comment Share on other sites More sharing options...
jeffman Posted July 25, 2010 Share Posted July 25, 2010 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 More sharing options...
wirehopper Posted July 26, 2010 Share Posted July 26, 2010 You could also use an .htaccess file with the following two directives:php_flag display_errors onphp_value error_reporting 30719http://www.php.net/manual/en/configuration.changes.phphttp://www.php.net/manual/en/errorfunc.constants.phpBe sure to remove them prior to making the site live. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.