我对openshift和这些git,ssh编程很新.到目前为止我开发了这么多.
安装 PHP 5.3,MysqL 5.5,PHPMyAdmin 4.0墨盒
安装 PHP 5.3,MysqL 5.5,PHPMyAdmin 4.0墨盒
这是我在PHP中的dbcon文件.
基本上我需要将我的PHP应用程序与openshift MysqL db连接.这就是我所做的.
<?PHP // Database Connection Setting $dbhost = "127.0.0.1"; // Host name $dbport = "3308"; // Host port $dbusername = "user"; // MysqL username $dbpassword = "pass"; // MysqL password $db_name = "mf"; // Database name $MysqLCon = MysqLi_connect($dbhost,$dbusername,$dbpassword,"",$dbport) or die("Error: " . MysqLi_error($MysqLCon)); MysqLi_select_db($MysqLCon,$db_name) or die("Error: " . MysqLi_error($MysqLCon)); ?>
这给了我一个关于openshift的错误,但适用于其他PHP应用程序.我的错误解释没有得到任何错误:{…空格…}.
你能救我一下吗?
非常感谢你的努力.之前没有抛出视觉错误.但是我这样做是为了让它发挥作用.
原文链接:/php/133245.html**
全球使用
**
define('DB_HOST',getenv('OPENSHIFT_MysqL_DB_HOST')); define('DB_PORT',getenv('OPENSHIFT_MysqL_DB_PORT')); define('DB_USER',getenv('OPENSHIFT_MysqL_DB_USERNAME')); define('DB_PASS',getenv('OPENSHIFT_MysqL_DB_PASSWORD')); define('DB_NAME',getenv('OPENSHIFT_GEAR_NAME')); $dbhost = constant("DB_HOST"); // Host name $dbport = constant("DB_PORT"); // Host port $dbusername = constant("DB_USER"); // MysqL username $dbpassword = constant("DB_PASS"); // MysqL password $db_name = constant("DB_NAME"); // Database name
**
另外
**
$dbhost = getenv('OPENSHIFT_MysqL_DB_HOST'); // Host name $dbport = getenv('OPENSHIFT_MysqL_DB_PORT'); // Host port $dbusername = getenv('OPENSHIFT_MysqL_DB_USERNAME'); // MysqL username $dbpassword = getenv('OPENSHIFT_MysqL_DB_PASSWORD'); // MysqL password $db_name = getenv('OPENSHIFT_GEAR_NAME'); // Database name