0
我是一个开发小老虎,我想弄清楚如何使用AWS Elastic beanstalk运行我自己的基本php。我遵循教程here,并能够成功部署并运行提供的php-secondsample脚本。但是,当我用自己的脚本创建一个新的应用程序时,该页面将返回空白。我通过网址“http://myenvironment.elasticbeanstalk.com/myfunction.php?action=test”任何帮助将不胜感激。如何使用AWS Elastic Beanstalk的URL参数运行PHP脚本?
这里被称为我的脚本的index.php
<?PHP
$action = $_GET['action'];
if($action == "") $action = $_REQUEST['action'];
$type = $_GET['type'];
myconnect();
if($action == 'test'){
echo "Success!";
}
function myconnect(){
define('DB_SERVER', 'redacted');
define('DB_USERNAME', 'redacted');
define('DB_PASSWORD', 'redacted');
define('DB_DATABASE', 'redacted');
$connection = mysql_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) or die(mysql_error());
//$database = mysql_select_db(DB_DATABASE) or die(mysql_error());
if (!$connection) {
echo("<p>Unable to connect to the " .
"database server at this time.</p>"
);
exit();
}
// Select the database
if (!mysql_select_db(DB_DATABASE)) {
echo("<p>Unable to locate the medical " .
"database at this time.</p>");
exit();
}
}
?>
你在哪里定义了'myconnect()'函数?如果没有定义,你会得到致命的错误(和空白页)。 – 2014-10-07 14:52:54
你能看看你的日志吗?您可以使用http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html – 2014-10-07 15:42:23
@MikeBrant获取日志,请检查我的编辑。我添加了myconnect函数。谢谢 – DollaBill 2014-10-07 15:48:01