0

Suddenly all my images and stylesheet running on PHP55 Standard Environment Google App Engine are broken. They show similar issues to this:

PHP Parse error: syntax error, unexpected 'Y9gG??' (T_STRING) in /base/data/home/apps/f~streamplate-landingpage-228223/early-access:20190201t232344.41581292385049

Here's my app.yaml file:

runtime: php55
service: early-access
api_version: 1
threadsafe: true

handlers:
- url: /(.+\.php)$
script: www/\1

- url: /
script: www/index.html

This was working fine and then suddenly - after changing some PHP code that I've now reverted back to previous/working state - the images and CSS don't load!

This is my PHP code:

<?php

 if(isset($_POST['email'])){
    $dsn = getenv('MYSQL_DSN');
    $user = getenv('MYSQL_USER');
    $password = getenv('MYSQL_PASSWORD');
    $pdo = new PDO($dsn, $user, $password);

    $email = $_POST['email'];

    $sql = "INSERT INTO emails (`email`) VALUES ('$email')";

    $stmt = $pdo->query($sql);

    header('Location: index.html');
    exit();

    }
?>

Any help would be greatly appreciated! Thanks :)

Hews
  • 569
  • 6
  • 19
  • 2
    maybe not related, but since you adopted the PDO driver, you should looking into using `prepared statements` too. Minor changes, major security gains. – YvesLeBorg Feb 01 '19 at 13:09
  • That is the **whole** PHP code? How does it handle CSS files and images if it only uses some database code? – Nico Haase Feb 01 '19 at 13:19
  • @NicoHaase the rest is just static HTML. It's a landing page with just a simple input field at the bottom. The PHP code is for the action flag. – Hews Feb 01 '19 at 13:28
  • Are you sure that your images are not piped through the PHP process? – Nico Haase Feb 01 '19 at 13:33
  • @NicoHaase do you mean that they're getting served as dynamic content with PHP? I've change my app.yaml so the images/css load now but I can't get the PHP code to work - it shows up as a 404 error. – Hews Feb 01 '19 at 13:38

0 Answers0