WordPress Install – “end of script output before headers” when running simple php script
I have a multi-site WordPress installation for a client, and for one of the forms I need to do some manual database interaction as the feature is separate.
The problem I’m having however, is that any simple PHP script I uploaded to anywhere on the site is throwing an “end of script output before headers” error according to the logs.
The script is literally only echo-ing “hello world”, and the permissions are set to 755.
Is there something to do with WordPress that could be causing this issue? The entire site works completely fine otherwise. It’s confusing to say the least
Is there something I need to include that’s WordPress specific to the file at the beginning?
There is no code to share really – there is an html form:
<form action="<?php bloginfo('template_directory') ?>/add-calories.php" method="get" id="add-calories"> <input class="required" type="text" name="item" placeholder="Food or Drink"> <input class="required" type="number" name="calories" placeholder="Calories"> <input class="required" type="time" name="time" placeholder="Time"> <input class="required" type="date" name="date" placeholder="Date"> <button type="submit">Add to diary<i class="fa fa-chevron-right"></i></button> </form>
Initially the php script this form points to echo’d out the $_POST variables, but currently it simply reads:
<?php echo "hello world!"; ?>
I have tried checking for headers being sent with
headers_sent(), but that didn’t seem to help much either…