• Hi, I am developing a plugin with vendor packages installed using composer. I am trying to avoid uploading the extension with the packages included (which creates a big file that causes problems on servers with upload limits), and am wondering if I can instead install the packages automatically during activation. I tried using PHP’s “exec” command but it doesn’t seem to work, and I’m not sure why. Any ideas?

    • This topic was modified 3 years, 2 months ago by paulchoix.
    • This topic was modified 3 years, 2 months ago by paulchoix.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If this is for a plugin you’re going to submit to www.ads-software.com, I suggest asking in the #pluginreview channel on Slack. (https://make.www.ads-software.com/slack)

    Dion

    (@diondesigns)

    Some sites disable the exec(), shell_exec(), and passthru() functions for “security” reasons. (“Security” in quotes because it’s only necessary when a webserver is poorly configured.)

    Perhaps you should consider setting up the correct vendor directory on your own site, removing the contents of src in each package directory, and distributing the “src-less” vendor directory. You can then use WP to download the appropriate package release archives/tarballs from GitHub into their respective source directory, then unpack each archive/tarball.

    ZIP archives are best since there is built-in support in WordPress to unpack them. However, there is native PHP support to unpack .tar.gz tarballs using gzinflate, then using the PharData class to extract the files from the inflated tarball. This would require the zlib and Phar PHP extensions, which will almost always be available.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Running “composer install” on plugin activation’ is closed to new replies.