I need my index file to point to another index file. In this case index.php points to index-1.php. The problem I'm facing is the PHP in index-1.php is not running. I've tried 2 ways in my index.php file to access index-1.php
// way 1
require_once __DIR__ . "/web/source/index-1.php";
and I've tried a framework (silex ) ( setup code is omitted but it works fine ).
// way 2
$app->get('/{name}', function($name) use($app) {
return $app->sendFile(__DIR__ . '/web/source/index-1.php');
});
In each case the raw file is sent to the client with out the php being interpreted.
How do I make the PHP file actually run?
I've verified the basic things, such as the file paths being set correctly and the file actually being sent.
Requiring or including is a valid way to have php code run. There is an error in this code path if your code is not running.
You need to post more code.
SendFile()
is not a valid way to have code run as it only sends a file.