App Engine Failed to guess mimetype for PHP files

Google App Engine, PHP, Mimetype, app.yaml, static_dir, script, static_files

When I deploy my site, PHP files cause an msg error:

Failed to guess mimetype for

This is the configuration file appl.yaml:

application: applicationname
version: 1
runtime: php
api_version: 1
threadsafe: true

handlers:

- url: /
  script: index.php

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

- url: /Client_Pages
  static_dir: Client_Pages

Files that cause the error are not uploaded to the deployed website. These same files work fine Google App Engine Launcheron my computer.

The file index.phpin the root directory does not cause errors and does not run on the deployed website.

, PHP html, ? PHP html Client_Pages. , , , , .

PHP app.yaml PHP, html .

application: yardsalesuperhighway
version: 1
runtime: php
api_version: 1
threadsafe: true

handlers:

- url: /Client_Pages/Offered_Menu.php
  script: Client_Pages/Offered_Menu.php

- url: /Client_Pages/InputForm.php
  script: Client_Pages/InputForm.php

- url: /Client_Pages/WantedPage.php
  script: Client_Pages/WantedPage.php

- url: /Client_Pages
  static_dir: Client_Pages
+4
3

, static_dir, .

-

application_readable

. , , , . true, , .

, app.yaml . , , , . appengine.

+2

, . , , . , , application_readable: true mime_type: text/html , php . , , app.yaml :

application: yardsalesuperhighway
version: 1
runtime: php
api_version: 1
threadsafe: true

handlers:

- url: /Client_Pages/Offered_Menu.php
  script: Client_Pages/Offered_Menu.php

- url: /Client_Pages/InputForm.php
  script: Client_Pages/InputForm.php

- url: /Client_Pages/WantedPage.php
  script: Client_Pages/WantedPage.php

- url: /Client_Pages
  application_readable: true # allow for PHP s in the dir to be executable by the application (as specified in the documentation provided by Tim)
  mime_type: text/html # assuming the PHP s will be echoing something, have what the echo as html (I got the mime types from http://www.iana.org/assignments/media-types/media-types.xhtml)
  static_dir: Client_Pages

, HTML , php-.

+2

Instead of using static_dir, consider using static_files only to download files you want statically:

handlers:

- url: /Client_Pages/(.*\.php)
  script: Client_Pages/\1

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

- url: /
  script: index.php
+1
source

Source: https://habr.com/ru/post/1532593/


All Articles