Jump to content

issues bootstrapping from script


j-w
 Share

Recommended Posts

For a worker process I need to bootstrap ProcessWire. Unfortunately somewhere in the bootstrap process the script simply exits, and I'm having problems identifying where and why.

Debugging a bit I found out that somewhere during the following call in the bootstrap index.php the script is exited:

echo $process->execute($config->internal);

Doing a debug_backtrace in the registered shutdown function gives me only a hint to ProcessWire\{closure}
Unfortunately with all php error logging on and $config->debug = Config::debugVerbose; I dont' get any more information as to why the script exits. Also tracy logs don't show anything.

I already investigated if there are any culprits among the hooks but can't find anything suspicious.

The script looks as follows:

#!/usr/bin/php
<?php namespace ProcessWire;
	echo "this is reached!";
	include("../www/index.php"); //bootstrap ProcessWire
	echo "this is never reached!";
Link to comment
Share on other sites

  • 1 month later...

I had the same problem and it had me perplexed for a while. My Command Line Interface script bootstraps ProcessWire and then fails without even the tiniest hint of an error message.

In my case, the problem was that code from /site/ready.php was being executed when ProcessWire was bootstrapped. The code I had in /site/ready.php was only intended for execution in specific situations while web browsing (not CLI). So I took the code inside that file and wrapped it inside this:

if(php_sapi_name() !== "cli") {
	// code inside /site/ready.php
}

 

Edited by Hero
  • Like 4
Link to comment
Share on other sites

  • 10 months later...

I got the same error. But my error seems to be coming from one of the modules. At least commenting out this string in the ProcessWire::ready() makes it work

// $this->fuel->get('modules')->triggerReady();

Does anyone know how do to deal with this? I am disabling site modules one by one to figure out, which one is causing trouble, but without success so far. Is there a way to quickly find out the root of the problem?

Maybe there is a way to disable modules while bootstrapping (but it might not be such a good idea, as they can add functionality that is supposed to work when running bootstrapped scripts).

Any help appreciated))

Link to comment
Share on other sites

As always, as soon as you write a post you find a solution) I did turn on $config->debug and figured out it was related with PW not being able to set session as headers already sent. That was my test output before the inclusion of the ProcessWire index.php in the bootsrap script. Cannot output anything before you include it.

The issue persists.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...