<?php
session_start();
?>

Is giving me the error:

Fatal error: Call to undefined function phpsession_start() in /home/search.php on line 1

However, the following code executes with no errors:

<?
session_start();
?>

Anyone know what could possibly be the problem?
Thanks

    Since the error message states that the function called was "phpsession_start()", I would say double check that you do indeed have some whitespace between the '<?php' tag and the [man]session_start/man function call.

    If it still doesn't work, try renaming the .php file to .txt and attaching it to your next post - that way we can examine the characters in the file directly.

    EDIT: I was curious, so I examined the possibilities myself. The following code:

    <?phpsession_start();
    ?>

    was simply outputted to my browser - PHP apparently expects whitespace to follow the '<?php' tag, else it doesn't recognize it as the beginning of PHP code.

    The only way I could reproduce your error message was by enabling short_open_tag; apparently, "<?php" must be followed by a whitespace for PHP code to be parsed, whereas "<?" does not.

    The solution? Ensure that there is whitespace after '<?php', but disable short_open_tag! :p It's recommended that you avoid it, anyway.

      Write a Reply...