Giter VIP home page Giter VIP logo

Comments (16)

omron93 avatar omron93 commented on July 22, 2024

@maicolcantagallo More info about adding mongodb driver can be found in #169

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

Thanks @omron93 but i did not understand how to make the configuration. I've created a source code pods and a mongodb storage pods. Am I doing something wrong?

from s2i-php-container.

omron93 avatar omron93 commented on July 22, 2024

Thanks @omron93 but i did not understand how to make the configuration. I've created a source code pods and a mongodb storage pods. Am I doing something wrong?

I think you do it right. Mongo driver has to be somehow installed in your source code pod to be able to access database.

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

thanks @omron93 but I do not understand how to install mongo db inside the pod.
when i lunch command pecl install mongodb-1.3.0 return Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user

from s2i-php-container.

wgordon17 avatar wgordon17 commented on July 22, 2024

@maicolcantagallo As a quick work around, please see the below instructions for using a PHP S2I image that I had created specifically to include the mongodb drivers. This is a workaround until I can update #169 to allow users to pecl install themselves.


In the web console, go to Builds > Builds. Click on the name of your application, and then under Actions, select Edit. Next change Build From to "Docker Image", and specify the following image depending on your version of PHP:

  • wgordon/openshift-s2i-php-56:latest for PHP 5.6
  • wgordon/openshift-s2i-php-70:latest for PHP 7.0

Then hit save! That's it. This is also assuming that you already have a composer.json file that includes "mongodb/mongodb". You can see an example of that here.

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

thanks @wgordon17 . do I have to import Docker Image source into my php source codes or do I have to insert an external path?

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

When start build application return this error

Pulling image "maicolcantagallo/s2i-php-container/7.0" ...
pulling image error : unauthorized: authentication required
error: build error: unable to get maicolcantagallo/s2i-php-container/7.0:latest

from s2i-php-container.

wgordon17 avatar wgordon17 commented on July 22, 2024

Hi @maicolcantagallo, you don't have to import it at all, you can just change the Build From value. Also, you have to specify Docker Image and use "wgordon" to pull from my DockerHub account

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

Thanks @wgordon17 . Now return this error

Pulling image "wgordon/openshift-s2i-php-70:latest" ...
pulling image error : manifest unknown: manifest unknown
error: build error: unable to get wgordon/openshift-s2i-php-70:latest

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

Sorry, i was wrong to choose php version

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

First step it's ok. Where is composer.json? I can't find it in my source

from s2i-php-container.

wgordon17 avatar wgordon17 commented on July 22, 2024

@maicolcantagallo It's a file to tell Composer what dependencies are necessary to install. In the case of MongoDB, you need both the drivers (solved with my custom Docker image), and the extensions (solved by Composer).

Your composer.json file can be a very simple

{
    "require": {
        "mongodb/mongodb": ">=1.0"
    }
}

Add that to your git source, and re-build. The PHP S2I image handles the rest!

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

now works fine!

Thanks @wgordon17

from s2i-php-container.

maicolcantagallo avatar maicolcantagallo commented on July 22, 2024

sorry @wgordon17 another question. If i want to use MongoClient instead of MongoDB\Driver\Manager is possibile?

Thanks

from s2i-php-container.

wgordon17 avatar wgordon17 commented on July 22, 2024

@maicolcantagallo MongoClient has been deprecated, I'm not familiar enough with it to know how to install it. Sorry

from s2i-php-container.

phracek avatar phracek commented on July 22, 2024

Since MongoClient has been deprecated, then I am closing this issue. Feel free to reopen it in case it is still valid.

from s2i-php-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.