title: how to set change directory to one where PHP app exists on Amazon Elastick Beanstack in post deployment script
body: <p>I created post deployment script for PHP app existing on Amazon Elastick Beanstack. The script is started properly on remote machine, but probably the current directory is not one where application exists.</p>
  
  <p>How to change path to get where PHP application is installed on Amazon Elastick Beanstack instance?</p>
  
  <p>EBextension file:</p>
  
  <pre><code>commands:
    create_post_dir:
      command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
      ignoreErrors: true
  files:
    "/opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh":
      mode: "000755"
      owner: root
      group: root
      content: |
        #!/usr/bin/env bash
        # cd $EB_CONFIG_APP_CURRENT
        chmod 777 wp-content/plugins/wp-scss/cache
        chmod 777 wp-content/themes/XXXX/css
  </code></pre>
  
  <p>The error logs:</p>
  
  <pre><code>2014-12-03T12:59:43.642Z] ERROR [22868] : Command execution failed: [CMD-AppDeploy/AppDeployStage1/AppDeployPostHook/99_change_access_rights.sh] command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh
  chmod: cannot access âwp-content/plugins/wp-scss/cacheâ: No such file or directory
  chmod: cannot access âwp-content/themes/XXXXX/cssâ: No such file or directory (ElasticBeanstalk::ActivityFatalError)
      at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.0/lib/elasticbeanstalk/activity.rb:189:in `rescue in exec'
      ...
  caused by: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh
  </code></pre>