PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 2, 2022

[FIXED] post-install-cmd not working in Google App Engine Flexible Environment

 March 02, 2022     app-engine-flexible, composer-php, gcloud, google-app-engine, google-cloud-platform     No comments   

Issue

I am trying to update a file permission via composer's post-install-cmd but seems to me it is not working correctly though in the log it says the command executed correctly but when I log in to the VM it still show the incorrect permission.

This is what I have in /composer.json

"scripts": {
    "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-install-cmd": [
        "chmod -R 777 public\/external_package\/webmail\/data"
    ]
}

This is what I have in my /app.yaml

runtime: php
env: flex

service: webservice-dev

runtime_config:
  document_root: public
  whitelist_functions: phpversion,phpinfo

env_variables:
  # Environment variables.
  APP_NAME: 'Laravel App (Dev)'
  APP_ENV: dev
  # ...
  # ...

beta_settings:
  cloud_sql_instances: ""

automatic_scaling:
  min_num_instances: 2
  max_num_instances: 10
  cpu_utilization:
    target_utilization: 0.50

resources:
  cpu: 1
  memory_gb: 4

Here is the screenshot of Cloud Build

gcp file permission issue

And this is what I see in VM

dr-xr-x--- 1 root www-data  4096 Jan 28 19:18 data

I want this directory permissions to be 777 rather than 550


Solution

This is because App Engine always locks the document root path, for this reason the permissions are reverted.

Add this to your app.yaml

runtime_config:
  skip_lockdown_document_root: true

The option skip_lockdown_document_root: true will prevent permissions from being changed.



Answered By - Jan Hernandez
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing