Search code examples
phpincludeexecution

Why is PHP execution stopping after a script is included?


I have the following code I use to call a script on demand:

<?php
include '../includes/header.php';

// Runs whitelist cron
echo "Rebuild latest reviews include file...";
include 'cron_dp_top10.php';
echo "Done!<br>";

echo "Please wait... Redirecting to CAMDB Index page...";

sleep(15);
?>
<script>
window.location.href='index.php';
</script>
<?php 
include '../includes/footer.php';
?>

The page is only displaying to the "include 'cron_dp_top10.php';" line. So it seems like it is stopping on the page include somehow.

However, the included script is executing with no issues all the way through the end. It makes me think there is an issue with the last bit of code the included script runs which is the following:

// Update permissions on static files in directory
$dh = dir ("$path/CAMDB/static/wb");
while ($entry = $dh->read()) {
    chmod ($entry, 0755); 
}
$dh->close();

It makes it seem like there's something with the directory read that is stopping the parent script from continuing. Can anyone shed some light on this issue?

Thanks!


Solution

  • Cfreak's comment sent me in the right direction. The script was kicking a permissions error on the logs. Writing this so I can mark the question as answered.