Sunday, 15 April 2012

Google App Engine with Multiple Folders PHP -



Google App Engine with Multiple Folders PHP -

i having problem getting script in different folder work. new google app engine, totally new yaml.

the folder construction is:

/login.php /includes/mysqlconnection.php

app.yaml

application: test version: 1 runtime: php api_version: 1 handlers: - url: /includes static_dir: includes application_readable: true - url: /login.php script: login.php

login.php

<?php header('content-type: application/json'); if($_post) { //get username , password $user_email = strip_tags(trim(strtolower($_post['username']))); $user_password = strip_tags(trim($_post['password'])); //connect mysql server include $_server['document_root']."includes/mysql_connection.php"; // //select database work $database = mysql_select_db("test",$mysql_connection) or die("cannot connect user table"); echo json_encode(array('success' => 1,'error_message' => "success")); } ?>

/includes/mysql_connection.php

<?php $hostname = '127.0.0.1:3306'; $db_username = 'root'; $db_password = ''; //connection database $mysql_connection = mysql_connect($hostname, $db_username, $db_password) or die("unable connect mysql"); ?>

this not work, if take code out of /includes/mysql_connection.php , set /login.php works perfectly.

can point me in right direction?

document_root not have trailing '/', looks you'll need add together one.

in http://php-minishell.appspot.com/ tried out

>>> echo $_server['document_root']; /base/data/home/apps/s~php-minishell/20140319.374522287571266149

so alter code to

//connect mysql server include $_server['document_root']."/includes/mysql_connection.php";

php google-app-engine app.yaml

No comments:

Post a Comment