Home » Php » php – Google App Engine "Error parsing ./app.yaml: Unknown url handler type"

php – Google App Engine "Error parsing ./app.yaml: Unknown url handler type"

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m following a tutorial on how to install PHPMyAdmin on Google App Engine and I followed the directions exactly and when I go to push the app, I’m getting a parsing error. This is the tutorial link:
https://gae-php-tips.appspot.com/2013/05/26/setting-up-phpmyadmin-on-app-engine/

I searched out Stackoverfllow and found some questions with the same error, and almost everyone said their is an indention issue that causes it, but I have reviewed my file several times an have not found any indentations in the app.yaml file.

This is my app.yaml file

application: phpmyadmin2121
version: phpmyadmin
runtime: php
api_version: 1

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: phpMyAdmin/
upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true

- url: /(.*\.(htm$|html$|css$|js$))
static_files: phpMyAdmin/
upload: phpMyAdmin/(.*\.(htm$|html$|css$|js$))
application_readable: true

- url: /(.*\.(php$))
script: phpMyAdmin/
secure: always
login: admin

- url: /(.+)
script: phpMyAdmin/index.php
secure: always
login: admin

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

Here is the command line prompt showing the error:

Michaels-MacBook-Air:phpMyAdmin Mike$ appcfg.py -R -A phpmyadmin2121 -V phpmyadmin update .
Usage: appcfg.py [options] update | [file, …]

appcfg.py: error: Error parsing ./app.yaml: Unknown url handler type.
<URLMap 
    secure=default 
    static_files=None 
    application_readable=None 
    auth_fail_action=redirect 
    require_matching_file=None 
    static_dir=None 
    redirect_http_response_code=None 
    http_headers=None 
    url=/(.*\.(ico$|jpg$|png$|gif$)) 
    script=None 
    upload=None 
    api_endpoint=None 
    expiration=None 
    position=None 
    login=optional 
    mime_type=None
    >
  in "./app.yaml", line 8, column 1
How to&Answers:

In case anyone else comes across this, I had the same issue. You must add TWO spaces for all subdirectories. Make sure the words are in line with “url”.

Doesn’t work:

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

Doesn’t work:

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

WORKS:

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

Also, change the line to update the app from this:

appcfg.py -R -A my_application_id -V phpmyadmin update .

To this:

appcfg.py --oauth2 -R -A my_application_id -V phpmyadmin update .

For some odd reason, the first command asks for your email and password (my personal email didn’t work). Using the second command with the –oauth2 option just works.

Answer:

Try adding a space for any sub item. PHP uses the same parser as python. In python white space is used to denote blocks.

application: phpmyadmin2121
version: phpmyadmin
runtime: php
api_version: 1

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
  static_files: phpMyAdmin/
  upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))
  application_readable: true

- url: /(.*\.(htm$|html$|css$|js$))
  static_files: phpMyAdmin/
  upload: phpMyAdmin/(.*\.(htm$|html$|css$|js$))
  application_readable: true

- url: /(.*\.(php$))
  script: phpMyAdmin/
  secure: always
  login: admin

- url: /(.+)
  script: phpMyAdmin/index.php
  secure: always
  login: admin

- url: /
  script: phpMyAdmin/index.php
  secure: always
  login: admin

Answer:

I had the same issue. The mistake in the tutorial are indeed the two missing spaces on the rows below the dash, so change from

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: phpMyAdmin/
upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))

to

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: phpMyAdmin/
upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))