Warning messages - Popen not available in PHP
darumaki - September 21, 2008 - 21:07
| Project: | Plugin Manager |
| Version: | 6.x-1.4 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
warning: popen() has been disabled for security reasons in
/sites/all/modules/plugin_manager/plugin_manager.module on line 322.
warning: fgets(): supplied argument is not a valid stream resource in
/sites/all/modules/plugin_manager/plugin_manager.module on line 323.
warning: pclose(): supplied argument is not a valid stream resource in /sites/all/modules/plugin_manager/plugin_manager.module on line 327.

#1
Joshua
I think you need to include a hook_requirements() and add in it :
<?phpif (!function_exists('popen')) {
...
}
?>
And checks for any other functions you need, ftp, ssh, ...etc.
This way, no errors can appear after the fact ...
#2
I get those php errors in the database log.
#3
I just can't get this module to work, nothing happening, I select a module, click on install, follow the instructions then more warning messages and a new message no module has been selected to install, what is the drupal FTP path suppose to be ?
#4
the "drupal FTP path" is the path relative to your FTP base directory of your drupal install.
e.g if your FTP base path is /home/foobar and your drupal install is located at /home/foobar/www/baz/ then you would enter "/www/baz" as your drupal FTP path.
what errors are you getting?
#5
When you say drupal ftp, do you mean the location of the drupal install ? It would be public_html then, although even with that it still not working. The warning messages are the ones above.
When trying to install, it keeps saying no nothing was selected to install even though one was selected.
#6
yes "/public_html" is probably the path you would enter.
are you using the latest dev version of PM?
It looks like your server won't let PM download the plugin files -- In your case, I think the only resort would be to use the manual install page (#281108)
#7
I have the same problem, I think - with 6.x-1.3
The installation of the Plugin Manager module seems to go fine (using Cpanel's Filemanager). But, when I go to the admin page (Administer -> Plugin Manager), I see these warnings in a red box near the top of the page
* warning: popen() has been disabled for security reasons in [MY PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 366.
* warning: fgets(): supplied argument is not a valid stream resource in [MY PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 367.
* warning: pclose(): supplied argument is not a valid stream resource in [MY PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 371.
I can do the installation process, and the module reports it is successful, but actually nothing has been stored on the server.
Manual install also didn't work, nothing appears on the server, and it also outputs lots of warning messages like this 'Duplicate entry 'themes/zen/LICENSE.txt' for key 1 query: INSERT INTO plugin_manager_files VALUES('', 'themes/zen/LICENSE.txt') in [PATH]/plugin_manager.admin.inc on line 262.
I don't know PHP, but it looks like my host/ISP has included popen in disable_functions because they believe it's a possible security risk.
FYI, here's the full list of all the PHP functions that my host has disabled in this way: exec,passthru,proc_open,readfile,proc_close,shell_ exec,system,popen,curl_exec - and PHP safe_mode is OFF.
Here's another Drupal module that had the same issue in the past: http://drupal.org/node/189060
Is there any chance this issue might be fixed in Plugin Manager in future, or is popen essential to it?
#8
Definitely possible to fix this (without requiring popen.) popen is used to look for / execute tar. I'll add this after classes end for the day most likely. You will need Archive/Tar from PEAR, but I don't think that should be a problem.
#9
#10
Same requirement for Popen exists in 6.x.1.4 - I assume this will still prevent it from working
warning: popen() has been disabled for security reasons in /home/[PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 374.
* warning: fgets(): supplied argument is not a valid stream resource in /home/[PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 375.
* warning: pclose(): supplied argument is not a valid stream resource in /home/[PATH]/sites/all/modules/plugin_manager/plugin_manager.module on line 379.
#11
this will only prevent the tar wrapper from working -- if you have the Archive_Tar module, you will be fine.
#12
OK, it is working for me, despite the Popen error messages. I succesfully installed, tested and uninstalled the A3 Atlantis Theme. Thanks.
Actually I didn't even need to install the Archive_Tar module. I guess I already have it somehow, although I can't see Tar.php anywhere in the Drupal directory
I can prevent those PHP warning messages by editing out the reference to Popen in plugin_manager.module (see code below). So it looks like this issue is more or less fixed for me.
function plugin_manager_runnable() {
// See if we have a way to untar the files.
@include_once("Archive/Tar.php");
if ( !class_exists("Archive_Tar")) {
drupal_set_message(t('The plugin manager cannot run because neither the tar executable nor the Archive/Tar package could be located.'), "error");
return FALSE;
}
// See if we have any available backends.
#13
Same here. I got the errors, but the module was working perfectly otherwise. After commenting out the popen and pclose lines and removing the check for popen in the if-statement the errors were gone.
Please let me know if I can supply any more specific info - thanks for this module!
#14
@ozish is this in version 1.4?
Does anyone have this problem in 1.7?
#15
My apologies - the version I'm using is 6.x-1.7 and my experience was exactly as described by bsimon in post #12
#16
Just changed the CVS copy. This should be gone in the development copy now. (Well, after drupal rebuilds the snapshot for the day.)
#17
Automatically closed -- issue fixed for two weeks with no activity.