Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli_set_process_title had an error #121

Open
s22-tech opened this issue Nov 13, 2021 · 5 comments
Open

cli_set_process_title had an error #121

s22-tech opened this issue Nov 13, 2021 · 5 comments

Comments

@s22-tech
Copy link

I keep getting the following message when running this script:

Warning: cli_set_process_title(): cli_set_process_title had an error: Not initialized correctly in /fink/bin/fink

It seems to run fine in spite of it, but I can't find how to get rid of it.

@dantleech
Copy link
Owner

dantleech commented Dec 28, 2021

Which platform is this (windows/mac/linux)?? Which PHP version?

@jrlpreadspeaker
Copy link

jrlpreadspeaker commented Oct 23, 2024

@dantleech Hello, I've got a similar error trying to use fink with cron.

/path_to_fink/fink https://www.site.com --output=/path_to_output/fink.json --max-external-distance=1 --exclude-url=/page/ --rate=2 --concurrency=2

Is my command, it gives an error near the one mentioned earlier when used with cron :
`
X-Powered-By: PHP/8.2.23
Content-type: text/html; charset=UTF-8


Fatal error: Uncaught Error: Call to undefined function cli_set_process_title() in /home/xxx/vendor/dantleech/fink/bin/fink:25 Stack trace: #0 /home/xxx/vendor/bin/fink(119): include() #1 {main} thrown in /home/xxx/vendor/dantleech/fink/bin/fink on line 25
`

Any idea why it trigger this error ?

Everything work fine when done from my terminal on the same server with the same command.
Best regards

@dantleech
Copy link
Owner

Are you using windows? Happy to accept a pull request that would wrap the call with if (function_exists('cli_set_process_title')

@jrlpreadspeaker
Copy link

jrlpreadspeaker commented Oct 23, 2024

@dantleech Sure, I'll send a pull request. Currently running on Linux.
https://www.php.net/manual/en/function.cli-set-process-title.php only available when using : CLI.

In cron it seems that PHP it used in "cgi-fcgi" (on my server)

@jrlpreadspeaker
Copy link

I've been able to fix the problem, I'm adding my solution so anyone who wants to turn it into cronjob knows.
If you want to use in cron :
/path_tofink/bin/fink yourargs

Might not work depeding on your PHP configuration.

What worked for me was :
/usr/local/bin/php -q /path_tofink/bin/fink

Glad I found how to be sure I'm using the right PHP bin from this Stack Overflow help :
https://stackoverflow.com/questions/19916949/running-php-from-cron-did-not-run-as-cli

-- Quote :

To fix this, first find the path to the correct php executable in a normal shell by typing this:

which php
This should give you a path like /usr/bin/php. You can go one further and check if this is actually a "symbolic link" pointing at a different filename:

ls -l $(which php)
(you'll see an arrow in the output if it is, like /usr/bin/php -> /usr/bin/php5-cli)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants