Hi all,
I am trying to install drush but keep getting this error message. The symlink works, but when I then execute "drush status" I get this message:

"PHP Fatal error: Call to undefined function posix_getppid() in /home/drush/includes/sitealias.inc on line 1907
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function posix_getppid() in
/home/drush/includes/sitealias.inc, line 1907"

I can't find any information about this function any or similar bug report. Please help!

Thanks

Comments

moshe weitzman’s picture

Issue tags: +Release blocker

This comes form the new site-set code.

greg.1.anderson’s picture

According to this posix_getppid manpage, this function is available for PHP3 >= 3.0.10, PHP4 >= 4.0b4. I can't imagine why this function would be unavailable. Maybe this is a Windows issue?

@Maxim75, what version of PHP are you using? What platform are you running on?

greg.1.anderson’s picture

Issue tags: +Windows

Ah, here we go:

http://www.php.net/manual/en/pcntl.installation.php
http://us3.php.net/manual/en/intro.posix.php

Doesn't work on Windows, not always available on Linux unless disabled. I imagine we need a function_exists, with some sort of fallback behavior when it is not available. One temp file == one site to use for all terminals, maybe (when posix_getppid not available)? Not ideal; maybe some Windows folks might know how to get a unique reference per-shell from Powershell / DOS / msysgit.

Edit: Accidentally quoted the wrong manual page; corrected.

tezalsec’s picture

Hi all,

well, that makes sense I couldn't figure it out.. I'm on Linux (OpenSuse), not on Windows. So I guess the function isn't available then. Further, I am working with PHP 5.2.x and Drupal 6.22.

But for now, to get drush going (on Drupal 6), since there are no stable releases other than the 7 (which I am assuming is only for Drupal 7?), do you recommend using the 4.x-dev version, or does that have the same issue/function?

Regards,
Maxim75

moshe weitzman’s picture

Stumbled on http://drupal.org/project/features_scripts, which suggests that at least MsysGit shell on Windows has Posix. So lets not remove feature for all Windows shells.

moshe weitzman’s picture

Wait - pcntl is not same as posix. We aren't using pcntl here.

My Windows does not have this posix_getppid() either (Windows 7). It is possible that Windows server OS support this function.

Someone might be able to use info on these links to get it working on other shells: http://www.codeproject.com/KB/threads/ParentPID.aspx and http://commandwindows.com/tasklist.htm.

FYI, I committed a fix for site-reset so that it works when we have set to a remote site.

moshe weitzman’s picture

Title: Call to undefined function posix_getppid() » Missing posix_getppid() on Windows - breaks site-set
Issue tags: -Release blocker

Just to get Windows working again, I added a function-exists() before calling this function and committed to master. See 7162b1a.

Leaving this open in case we want to do more.

beltofte’s picture

Neither PHP 5.3.8 or 5.2.17 running on my VM with Windows Server 2008 R2 has this function.

greg.1.anderson’s picture

Re #6, yes, I accidentally wandered into the wrong section of the manual in #3; corrected above.

beltofte’s picture

PowerShell has a variable called $pid which holds the process id. More details can be fetched using "get-process -id $pid". This does not work in CMD, and does not seems to work when executed using exec(), shell_exec(), system() etc.

Tasklist.exe both works on CMD and PowerShell, but it returns details on all processes or specific processes. If you have multiple PowerShell or CMD processes running is there not way to find the correct one......

http://www.codeproject.com/KB/threads/ParentPID.aspx. We could make an .exe file to return the parent process id using some of the Windows API's. It could be distributed in the Windows Installer or together with Drush it self. I could get one of our .NET developers to make this, if this is the solution we are going with.

greg.1.anderson’s picture

Regarding the .exe proposed at the end of #10: if we built this and ran it from Drush via exec/etc., would it return the pid of Drush, or the pid of the shell that ran Drush?

If the later former, maybe we could call it from drush.bat, and pass the result in as a parameter to Drush.

beltofte’s picture

Hmm.... good question. I will ask one of our .NET developers about this.

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.