2015-05-12 53 views
0

我試圖製作一個應用程序,讓用戶在登錄到服務之前進行身份驗證。我正在使用Google App Engine和PHP;該應用程序在我的計算機上正常工作,但在部署到Google Cloud後,PHP文件無法運行。我擁有根目錄中的所有文件。部署到雲後的Google App Engine和PHP空白頁面。 (Ubuntu 14.04 LTS)

這是我的app.yaml

application: civil-topic-94103 
version: 1 
runtime: php55 
api_version: 1 

handlers: 
- url: /registration.php* 
    script: registration.php 

- url: /login.php* 
    script: login.php 

- url:/
    static_files: homepage.html 
    upload: homepage.html 

# access the static resources in the root directory 

- url: /(.*) 
    static_files: \1 
    upload: (.*) 

這是我的login.html文件:

<html> 
<head> 
<title>login</title> 
</head> 
<body> 
    <p><b>Please Login</b></p> <br> 
    <form action="login.php" method="post"> 
    User: <input type="text" name="username"><br> 
    Pass: <input type="text" name="password"><br> 
    <input type="submit"> 
    </form> 

</body> 
</html> 

這是我的login.php測試文件:

<?php 
echo "message"; 
?> 
INCORRECT USERNAME and/or Password 

這是我的日誌: enter image description here

點擊login.html中的提交按鈕後,我得到一個空白頁面。

有人知道發生了什麼嗎?

+0

如果你改變' - 網址:/ login.php中*''來 - 網址:/ login.html'做任何改變嗎? – doru

+1

你app.yaml中的最後一個處理程序看起來像這裏的罪魁禍首。嘗試刪除它或將您的靜態資產放在一個文件夾中而不是根目錄下。 – Mars

+0

doru:如果我將「 - url:/login.php*」替換爲「 - url:/login.html」,我得到一個空白頁面而不是獲取login.html輸出。 – jjf

回答

0

好吧,這是我解決了這個問題: 我花了一些代碼從本網站https://gist.github.com/darktable/873098

我創建了一個名爲「staticfiles」,並感動了所有的HTML文件,它(exept的homepage.html)。

我改變:

- url: /(.*) 
    static_files: \1 
    upload: (.*) 

- url: /(.*\.html) 
    mime_type: text/html 
    static_files: staticfiles/\1 
    upload: staticfiles/(.*\.html) 
相關問題