This is a discussion on can't proc_open() gpg; within the PHP Language forums, part of the PHP Programming Forums category; Hi, I've been trying to run gpg through proc_open() and have failed all weekend. I keep getting this error ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I've been trying to run gpg through proc_open() and have failed all weekend. I keep getting this error from stderr: "/usr/bin/gpg: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied" Im running php 4.3.11 on fedora 3. Here is the method i've been debugging. It should just run '/usr/bin/gpg --version' and display the output. Thanks in advance -r /// /// This method produces the output below... /// function gpgVerify() { $gpgPath = '/usr/bin/gpg'; if(!is_executable($gpgPath)) { trigger_error("gpgVerify::gpg is not executable", E_USER_ERROR); die(); } else { // first we'll set up a pipe for gpg to write STDOUT to $descriptorSpec = array( 1 => array("pipe", "w"), 2 => array("pipe", "w") // STDERR is a pipe that GnuPG will write to); ); $command = $gpgPath . " --version"; $gpgProcess = proc_open( $command, $descriptorSpec, $pipes); if(is_resource($gpgProcess)) { $gpgOutput = ''; while(!feof($pipes[1])) { $gpgOutput .= fgets($pipes[1], 1024); } echo '<hr>pipe[1] = <p>'.$gpgOutput; fclose($pipes[1]); $stdErrOut = ''; while(!feof($pipes[2])) { $stdErrOut .= fgets($pipes[2], 1024); } echo '<hr>pipe[2] = <p>'.$stdErrOut; fclose($pipes[2]); // close the $gpgProcess $processExitStatus = proc_close($gpgProcess); echo '<hr>$processExitStatus:<p>'.$processExitStatus; if(!ereg('^gpg ', $gpgOutput)) { trigger_error("gpg executable is not GnuPG.", E_USER_ERROR); die(); } unset( $gpgPath, $gpgOutput, $descriptorSpec, $command, $gpgProcess, $pipes, $processExitStatus, $gpgErrorMessage ); } else { trigger_error("resource not available", E_USER_ERROR); die(); } } return true; } /// /// output /// pipe[1] = pipe[2] = /usr/bin/gpg: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied $processExitStatus: 127 Fatal error: gpg executable is not GnuPG. in /home/test/public_html/SafeHaven2.0/EfmDebug.php on line 167 |
|
|||
|
razorfold@gmail.com wrote:
> Hi, > > I've been trying to run gpg through proc_open() and have failed all > weekend. I keep getting this error from stderr: > > "/usr/bin/gpg: error while loading shared libraries: cannot restore > segment prot after reloc: Permission denied" > > Im running php 4.3.11 on fedora 3. Here is the method i've been > debugging. It should just run '/usr/bin/gpg --version' and display the > output. It is SELinux blocking the access. If you look in /var/log/messages, you'll notice the security messages. I dont know diddely squat about how to configure selinux, but I reckon you can find what you seek in below link. http://www.nsa.gov/selinux/papers/policy2-abs.cfm I the meantime, just to see your script work, you can (temporarily) disable the security enforcements by : # echo 0 > /selinux/enforce /Bent |