Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Fatal error: require_once() when activating GCS Media plugin #49

Open

Description

@ccherchi

Hi got these two errors when activating the GCS Media plugin:

Warning: require_once(/Users/(...)/wordpress/wp-content/plugins/gcs-media/vendor/autoload.php): failed to open stream: No such file or directory in /Users/(...)/wordpress/wp-content/plugins/gcs-media/gcs.php on line 33

Fatal error: require_once(): Failed opening required '/Users/(...)/wordpress/wp-content/plugins/gcs-media/vendor/autoload.php' (include_path='.:/Users/(...):/Users/(...)/google-cloud-sdk/platform/google_appengine/php/sdk') in /Users/(...)/wordpress/wp-content/plugins/gcs-media/gcs.php on line 33

All went fine with the Appengine plugin.

Activity

  1. sebastianbk commented on Apr 9, 2019

    @sebastianbk

    I followed the steps of GCP's tutorial here: https://cloud.google.com/community/tutorials/run-wordpress-on-appengine-standard

    And just like @ccherchi I ran into this issue. Is there still no fix for this? Since I ran since in a clean GCP project, I am imagining that other users following the tutorial will experience exactly the same issue.

  2. sebastianbk commented on Apr 9, 2019

    @sebastianbk

    So it turns out that the vendor folder inside of the gcs plugin isn't even being uploaded when running the gcloud app deploy command, as the tutorial suggests. See the screenshot below.

    image

    Commenting out the following line from the .gcloudignore file in the root of my project directory and redeploying my site to App Engine resolved the issue, as the vendor folder was included this time. I don't know if this is best practice but it did work for me.

    # PHP Composer dependencies:
    vendor/
    
  3. DeanMarkTaylor commented on Apr 10, 2019

    @DeanMarkTaylor

    I've not dug into this myself - you might find this useful though...

    You can find details relating to this here:
    https://cloud.google.com/appengine/docs/standard/php7/specifying-dependencies

    Note the following:

    • Composer runs automatically when you deploy a new version of your application.
    • By default, the vendor/ directory is ignored in the generated .gcloudignore file to reduce the number of files sent in deployment.

    No real answers from me here, just an observation.

  4. ran-dall commented on Apr 10, 2019

    @ran-dall

    @sebastianbk Actually, @DeanMarkTaylor kinda has the answer for you. The vendor folder is missing because it's supposed to be built for you when you deploy when it runs Composer automatically for you. So I'd check your composer.json.

  5. sebastianbk commented on Apr 10, 2019

    @sebastianbk

    @ran-dall Well, I have no composer.json in my project structure. I'm certainly not a PHP guy so I just learned about Composer yesterday. My point is just that I followed the tutorial on GCP's website, step by step, and it didn't work, which puzzled me quite a bit.

  6. Zertz commented on May 9, 2019

    @Zertz

    The problem is exactly what @sebastianbk described above. The first time you run gcloud app deploy, it generates a .gcloudignore which adds /vendor/ but Google bundles vendor dependencies directly in the gcs plugin so it's preventing itself from working.

    I ended up removing it from both .gcloudignore and .gitignore to make it easy to develop and deploy.

  7. FrankM1 commented on May 20, 2019

    @FrankM1

    Ignoring vendor/ is a problem since there are plugins that use composer to bundle libraries. This means those too will malfunction.

  8. ran-dall commented on May 20, 2019

    @ran-dall

    @FrankM1 and @Zertz When you upload an application, you should be specifying your dependencies in a composer.json file. When Composer runs, it will automatically create the vendor directories.

    The ignored action is best practice, as you shouldn't be committing your vendor directories. It only ignores the instances of the dependencies you have locally installed in your system; only so that when you commit the codebase to AppEngine, it triggers to create its own set of dependencies. In that process, the vendor directories should be recreated from the source, and you'd end up with the same system.

    By default, the vendor/ directory is ignored in the generated .gcloudignore file to reduce the number of files sent in deployment.

    So for clarity, the local dependencies don't get transferred but essentially get recreated by AppEngine.


    @Zertz

    Google bundles vendor dependencies directly in the gcs plugin so it's preventing itself from working.

    @FrankM1

    Ignoring vendor/ is a problem since there are plugins that use composer to bundle libraries.

    You can install plugins through Composer package; although not every plugin is available. You can check on Packagist, if the plugin is available as a Composer package. You also need to make sure that the plugin is listed properly in the composer.json. Unfortunately, though there isn't a ready-made package for this plugin yet, but there are packages for other GCS plugins that accomplish the same thing. If you're set on using this particular plugin though, there are a few workarounds for installing plugins that aren't packaged yet, such as https://stackoverflow.com/questions/16847994/how-do-you-get-composer-to-install-a-non-composer-package.

    Hope that helped! 🤙

  9. FrankM1 commented on May 21, 2019

    @FrankM1

    Thank you @ran-dall This indeed does clarify a few points for me. 90% of plugins I deploy to app engine are in private repos. I'll need to figure out how to add those using composer. What you describe does make sense.

  10. wsnel commented on Apr 18, 2020

    @wsnel

    For me, the following worked for a GCE image (via GCP marketplace):

    ssh into the image, using console
    sudo apt-get install git
    cd ~
    git clone https://github.com/GoogleCloudPlatform/wordpress-plugins.git
    cd wordpress-plugins/gcs-media-plugin
    sudo apt-get install composer
    composer install

    cd ~
    sudo cp -r wordpress-plugins/gcs-media-plugin /var/www/html/wp-content/plugins/
    sudo chown -R www-data.www-data /var/www/html/wp-content/plugins/gcs-media-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions