0

Here is my site link and when i try to login then in network the response i get is the whole login.php code instead of the response after executing the php file. My app.yaml file is correct i have already double check it. My php files unable to execute in google cloud services.
Here is my app.yaml code

runtime: php55
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico
- url: /css
  static_dir: css
- url: /images
  static_dir: images
- url: /fonts
  static_dir: fonts
- url: /utils
  static_dir: utils
- url: /js
  static_dir: js  
- url: /index.html
  script: /index.html
- url: /signup.html
  script: /signup.html
- url: /.*
  script: index.html 
- url: /utils/login.php
  script: /utils/login.php
- url: /js/login.js
  script: /js/login.js
- url: /js/script.js
  script: /js/script.js
- url: /js/jquery.min
  script: /js/jquery.min
- url: /js/bootstrap.min
  script: /js/bootstrap.min
- url: .*
  script: main.php

and here is my login.php code

<?php


require 'dblinker.php';

function login(){
    try {
        $username = $_POST['username'];
        $password = $_POST['password'];

        // login function
        $handle=$conn->prepare("SELECT * FROM `users` WHERE `username`= :username AND `password`= :password");
        $handle->bindParam('username', $username, PDO::PARAM_STR);
        $handle->bindParam('password', $password, PDO::PARAM_STR);
        $handle->execute();
        if($handle->rowCount() == 1){
            $result=$handle->fetch(PDO::FETCH_ASSOC);
            $_SESSION["username"] = $result['username'];
            $_SESSION["role_id"] = $result['role_id'];
            echo "success";
        }else{
            echo "fail";
        }
    }
    catch(Exception $e){
        echo "F";
    }
}
session_start();
echo login();

?>
0

I am going to assume that it's a LAMP stack environment that you are in.

You need to install the related dependencies:

sudo apt install libapache2-mod-php php-mcrypt php-mysql php php-gd php-pear php-curl
  • Hi i am not using linux i am using app service .. there you can't install like linux so i don't understand what you mean to say ? – Syed Ali Raza Apr 19 '18 at 6:24
  • Ok, I see. But may you format the code a little bit before posting ? – Alex Lo Apr 19 '18 at 7:15
1

First please check phpinfo page working or not? Try with php-info.php using below code

<?php
phpinfo();
?>

Please refer docs for PHP Runtime Environment and app.yaml Reference

0

Perhaps modifying your app.yaml a little bit. For the last part:

 - url: .* 
   script: main.php

You are missing a forward slash. It should be:

- url: /.* 
  script: main.php
  • I change it too but still the same issue. Unable to execute the php files. – Syed Ali Raza Apr 19 '18 at 7:13
  • Are you deploying it using the PHP app engine ? Try the "Hello World" template first to see if it work. – Alex Lo Apr 19 '18 at 7:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.