Skip to content
Advertisement

PHP Notice: Use of undefined constant php – assumed ‘php’

Was just editing a site I’m working on to include the subscription form in the footer.php rather than just the homepage. I made the changes on the local server then moved it to my live environment (dev sub-folder). I didn’t see any errors on my localhost, but on the dev site it is showing the following error:

PHP Notice: Use of undefined constant php – assumed ‘php’ in /home/website-name/public_html/uk-en/dev/wp-content/themes/theme-name/footer.php on line 1

The only thing on line 1 is the opening php tag, see code below from the footer.php file

JavaScript

I could turn off notice display however I would like to get the right solution rather than a cover up

Advertisement

Answer

Basic syntax of php opening tag is <?php[whitespace] not just <?php, see here http://php.net/manual/en/language.basic-syntax.phptags.php#118827. So the right syntax would be adding a white space in between php opening and closing tag <?php ?>

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement