| Summary: | Fail to connect MongoDB via db driver for zend carts (zend-5.6 and zend-6.1) | ||
|---|---|---|---|
| Product: | OpenShift Online | Reporter: | Zhe Wang <zhewang> |
| Component: | Image | Assignee: | Vojtech Vitek <vvitek> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 2.x | CC: | hripps, xtian |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-01-30 00:51:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
PR fixes the problem with PEAR/PECL paths.
Notes:
Mongo extension is disabled by default in Zend Server. Users can enable it in the Zend Server Console (GUI) as follows:
1. Go to $APP_URL/ZendServer/Extensions/phpExtensions
2. Check 'mongo' and click Enable button
3. Click 'Restart' button in the right upper corner to restart PHP processes
If we want to have some of the extensions enabled by default, we should Feature Request it.
Right code to test against:
<?php
header('Content-Type: text/plain');
$m = new Mongo(getenv('OPENSHIFT_MONGODB_DB_URL'));
$db = $m->selectDB(getenv('OPENSHIFT_APP_NAME'));
$coll = $db->factory;
$count = $coll->find()->count();
if($count == 0) {
$insert = array("version" => "1");
$coll->insert($insert);
}
# Accessing the page without arguments
if(empty($_GET["version"])) {
$obj = $coll->findOne();
$m->close();
echo "version ".$obj["version"];
}
else {
$coll->remove();
$insert = array("version" => $_GET["version"]);
$coll->insert($insert);
$m->close();
echo "The mongodb factory is modified\n";
}
Hi, Vojtech, Thanks for your notes, following which this bug is verified in devenv_4102. Would you please move the bug to ON_QA, then I will change it to VERIFIED? Moreover, I am able to enable mongo extension by adding a pre_build hook in automation scripts to modify the php.ini, so that if won't block auto testing if mongo extension is not enabled in zend apps by default. I will report a feature request if still necessary. But modifying the php.ini leads nother problem that is irrelevant to this bug: after I enable mongo extension by echoing "extension=mongo.so" to $OPENSHIFT_HOMEDIR/configuration/etc/php.ini, the page of $APP_URL/ZendServer/Extensions/phpExtensions still shows that mongo is off. Do you think it is a bug of Zend studio itself or an openshift one? Thanks, Zhe Wang Sorry, it should be $OPENSHIFT_HOMEDIR/zend/configuration/etc/php.ini in Comment#3. @Zhe Wang, I think you're just hitting Zend Server cache. Try restarting the whole cartridge. Imho, the preferred way is to set the extensions via Zend Server Console GUI. Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/057d1b0ef9a7688065d95a6f9c70d6e48da70021 fix zend PEAR and PECL extensions Configure all the PEAR/PECL paths properly, add PEAR/PECL scripts for Zend Server Console. Bug 1036524 - Fail to connect MongoDB via db driver for zend carts (zend-5.6 and zend-6.1) https://bugzilla.redhat.com/show_bug.cgi?id=1036524 Bug 1036526 - Zend-6.1 app does not load installed dependencies from $OPENSHIFT_DEPENDENCIES_DIR by default https://bugzilla.redhat.com/show_bug.cgi?id=1036526 |
Description of problem: Given a zend-5.6 or 6.1 app with MongoDB-2.2 added, it fails to connect to the db via mongodb driver from its website, even though mongo.so is installed under /usr/local/zend/lib/php_extensions/ Version-Release number of selected component (if applicable): devenv_4084 How reproducible: always Steps to Reproduce: 1. create a zend app (5.6 or 6.1) with MongoDB added. 2. remove the app's hot_deploy marker to make sure the app is restarted properly (minimize the numbers of variables). 3. SSH into the app and check /usr/local/zend/lib/php_extensions/ to see if mongo.so is at presence. 4. create a php page to connect to mongodb with the following code. (You could verify the code with a php app) <----mongo.php---> <?php header('Content-Type: text/plain'); $m = new Mongo($_ENV['OPENSHIFT_MONGODB_DB_URL']); $db = $m->$_ENV['OPENSHIFT_APP_NAME']; $coll = $db->factory; $count = $coll->find()->count(); if($count == 0) { $insert = array("version" => "1"); $coll->insert($insert); } # Accessing the page without arguments if(empty($_GET["version"])) { $obj = $coll->findOne(); $m->close(); echo "version ".$obj["version"]; } else { $coll->remove(); $insert = array("version" => $_GET["version"]); $coll->insert($insert); $m->close(); echo "The mongodb factory is modified\n"; } ?> <----------------> 5. push the change 6. visit $APP_DNS/mongo.php 7. try to reinstall mongo module of the latest version echo "channel://pecl.php.net/mongo-1.4.5" > $APP_REPO/deplist.txt OR ssh into the app and run "pecl install mongo" Actual results: In step 3, we can see that mongo.so is at presence: -rwxr-xr-x. 1 root root 214872 Oct 2 2012 mongo.so but it returns error 500 when visiting the mongo.php page of the zend app. Moreover, reinstalling the mongo module fails with the error below: remote: ERROR: failed to write /usr/local/zend/lib/php_extensions/mongo.so (copy(/usr/local/zend/lib/php_extensions/mongo.so): failed to open stream: Permission denied) Expected results: Zend apps (5.6 or 6.1) should support MongoDB without errors in OpenShift. Additional info: