------ content ------

<?php require_once 'views/header.php'; ?> <html> <a href="views/content/content2.php"> content </a> </html> 

in the logs writes Fatal error: require_once (): Failed opening required 'views / content / header.php' (include_path = '.: / usr / share / php') in / var / www /targetspanish2.com/views/content/ content2.php on line 2

------ content2 ------

 <?php require_once 'views/header.php'; ?> <html> <a href="views/content/content.php"> content2 </a> </html> 
  • what code is it so impossible to understand? - L. Vadim
  • in, added) - Alexander
  • Well, there is no written file. - Naumov
  • you have a current script in views/content and a header in views/ . - teran

1 answer 1

it should work

 <?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .'header.php'); ?> <html> <a href="views/content/content.php"> content2 </a> </html> 
  • hell with transfer to another server will be provided. include_path should be edited and relative paths should be written, that's all. - teran
  • Try this, I changed the code. should work on all machines - L. Vadim
  • dirname(__FILE__) == __DIR__ ;) - E_p
  • answer helped? put a tick next to the answer - L. Vadim