Skip to content

Instantly share code, notes, and snippets.

@TiuTalk
Last active May 19, 2021 23:59
Show Gist options
  • Save TiuTalk/dd18b2797f9bbddce8dc to your computer and use it in GitHub Desktop.
Save TiuTalk/dd18b2797f9bbddce8dc to your computer and use it in GitHub Desktop.

Revisions

  1. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 34 additions and 0 deletions.
    34 changes: 34 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -69,3 +69,37 @@ location ~ ^/index.php$ {
    ```
    web: Vendor/bin/heroku-php-nginx -C Config/nginx.conf webroot
    ```

    #### Config/database.php
    ```php
    <?php
    class DATABASE_CONFIG {

    public $default;

    public $test = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'user',
    'password' => 'password',
    'database' => 'test_database_name',
    'prefix' => '',
    //'encoding' => 'utf8',
    );

    public function __construct() {
    $DATABASE_URL = parse_url($_ENV['DATABASE_URL']);
    $this->default = array(
    'datasource' => 'Database/Postgres',
    'persistent' => false,
    'host' => $DATABASE_URL['host'],
    'login' => $DATABASE_URL['user'],
    'password' => $DATABASE_URL['pass'],
    'database' => substr($DATABASE_URL['path'], 1),
    'prefix' => '',
    'encoding' => 'utf8',
    );
    }
    }
    ```
  2. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    #### webroot/index.php
    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . "/Vendor/cakephp/cakephp/lib");
    ```

    #### Config/bootstrap.php
  3. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    #### webroot/index.php
    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . '/Vendor/cakephp/cakephp/lib');
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');
    ```

    #### Config/bootstrap.php
  4. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    #### webroot/index.php
    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', '../Vendor/cakephp/cakephp/lib');
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . '/Vendor/cakephp/cakephp/lib');
    ```

    #### Config/bootstrap.php
  5. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 17 additions and 13 deletions.
    30 changes: 17 additions & 13 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    ## composer.json
    # CakePHP via composer

    #### composer.json

    ```json
    {
    @@ -15,13 +17,13 @@
    }
    ```

    ## webroot/index.php
    #### webroot/index.php
    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', '../Vendor/cakephp/cakephp/lib');
    ```

    ## Config/bootstrap.php
    #### Config/bootstrap.php
    ```php
    <?php
    // Load Composer autoload.
    @@ -34,7 +36,17 @@ spl_autoload_unregister(array('App', 'load'));
    spl_autoload_register(array('App', 'load'), true, true);
    ```

    ## config/nginx.conf
    #### .gitignore
    ```
    tmp/*
    app/tmp/*
    !empty
    Vendor
    ```

    # CakePHP on Heroku

    #### config/nginx.conf
    ```nginx
    location / {
    try_files $uri @rewriteapp;
    @@ -53,15 +65,7 @@ location ~ ^/index.php$ {
    }
    ```

    ## Procfile
    #### Procfile
    ```
    web: Vendor/bin/heroku-php-nginx -C Config/nginx.conf webroot
    ```

    ## .gitignore
    ```
    tmp/*
    app/tmp/*
    !empty
    Vendor
    ```
  6. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 32 additions and 8 deletions.
    40 changes: 32 additions & 8 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,27 @@
    # composer.json
    ## composer.json

    ```json
    {
    "name": "example",
    "name": "assando-sites",
    "require": {
    "cakephp/cakephp": ">=2.5.0"
    "cakephp/cakephp": ">=2.5.0",
    "ext-apcu": "*",
    "ext-imagick": "*",
    "ext-memcached": "*"
    },
    "config": {
    "vendor-dir": "Vendor/"
    }
    }
    ```

    # webroot/index.php

    ## webroot/index.php
    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', '../Vendor/cakephp/cakephp/lib');
    ```

    # Config/bootstrap.php

    ## Config/bootstrap.php
    ```php
    <?php
    // Load Composer autoload.
    @@ -33,8 +34,31 @@ spl_autoload_unregister(array('App', 'load'));
    spl_autoload_register(array('App', 'load'), true, true);
    ```

    # .gitignore
    ## config/nginx.conf
    ```nginx
    location / {
    try_files $uri @rewriteapp;
    }
    location @rewriteapp {
    rewrite ^(.*)$ /index.php last;
    }
    location ~ ^/index.php$ {
    fastcgi_pass heroku-fcgi;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
    }
    ```

    ## Procfile
    ```
    web: Vendor/bin/heroku-php-nginx -C Config/nginx.conf webroot
    ```

    ## .gitignore
    ```
    tmp/*
    app/tmp/*
  7. TiuTalk revised this gist Jun 1, 2014. 1 changed file with 1 addition and 14 deletions.
    15 changes: 1 addition & 14 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -40,17 +40,4 @@ tmp/*
    app/tmp/*
    !empty
    Vendor
    ```

    ```php
    <?php
    // Load Composer autoload.
    require APP . '/Vendor/autoload.php';

    // Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
    // most important.
    // See: http://goo.gl/kKVJO7
    spl_autoload_unregister(array('App', 'load'));
    spl_autoload_register(array('App', 'load'), true, true);
    ```

    ```
  8. TiuTalk renamed this gist Jun 1, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. TiuTalk created this gist Jun 1, 2014.
    56 changes: 56 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    # composer.json

    ```json
    {
    "name": "example",
    "require": {
    "cakephp/cakephp": ">=2.5.0"
    },
    "config": {
    "vendor-dir": "Vendor/"
    }
    }
    ```

    # webroot/index.php

    ```php
    <?php
    define('CAKE_CORE_INCLUDE_PATH', '../Vendor/cakephp/cakephp/lib');
    ```

    # Config/bootstrap.php

    ```php
    <?php
    // Load Composer autoload.
    require APP . '/Vendor/autoload.php';

    // Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
    // most important.
    // See: http://goo.gl/kKVJO7
    spl_autoload_unregister(array('App', 'load'));
    spl_autoload_register(array('App', 'load'), true, true);
    ```

    # .gitignore

    ```
    tmp/*
    app/tmp/*
    !empty
    Vendor
    ```

    ```php
    <?php
    // Load Composer autoload.
    require APP . '/Vendor/autoload.php';

    // Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
    // most important.
    // See: http://goo.gl/kKVJO7
    spl_autoload_unregister(array('App', 'load'));
    spl_autoload_register(array('App', 'load'), true, true);
    ```