r/PHPhelp • u/Dr_philociraptor • Jul 26 '25
Basic php Help, Include Error, Pathing Issue?
Started coding in php , but I can't seem to use "include" or "require_once", really basic level stuff, syntax is correct because if I drop the file directly into the code it runs without issue, but if I try to pull a saved file I run into an error
code to call -
<?php include 'includes/footer1.php';?>code being called -
<footer> © <?php echo date('y')?></footer>
</body>
</html>Warning: include(includes/footer1.php): Failed to open stream: No such file or directory in C:\xampp\htdocs\New folder\class_objects.php on line 46
Warning: include(): Failed opening 'includes/footer1.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\New folder\class_objects.php on line 46
both files are saved in my root folder, so what am I doing wrong here.
View all comments
Show parent comment
-4
u/[deleted] Jul 26 '25
I find it bad practice to use php after html. As it was intended to run before any html and output html all at once.
So it has to render again if called afterwards in html.
Of course you could close php run the html but then its triple rendering.
Which is sloppy code that will render slowly.
Php is not a bad language. However, some are taught sloppy coding practices that end up with slow rendering. But since this under xampp it has its own set of rules and conditions that are not 100% compatible with a bare metal install on a linux server.