syntax error, unexpected end of file

Description

The unexpected end of file happens when PHP has not finished parsing a file, and still expected a few more tokens to complete it.

Usually, this means that not enough code was provided, or also, that some code instruction were not completed as expected.

In the example here, the expression is completed with a semi-colon, or a closing PHP tag. Both would conclude the expression, and the script, but they are not available.

Example

<?php

$x = 1

Solutions

  • Make sure all expression are completed.