Deploying to heroku
  • Hi,

    I am wasting a bunch of time trying to connect to an external mysql db from a heroku environment.

    I did the following task previously to deploy:

    1. Where the mysql DB is located, i did Enable the remote mysql connections from %.herokuapp.com
    2. Did add the DB: heroku config:add DATABASE_URL=mysql://user:pass@server:port/database_name
    3. Add the the temporal url to the environments.php file and properly setup the db config string:

    $db_url = parse_url(getenv("DATABASE_URL"));
    $db_server = $db_url["host"];
    $db_username = $db_url["user"];
    $db_password = $db_url["pass"];
    $db_db = substr($db_url["path"],1);

    Any suggestions? Thanks!
  • This doesn't sound like a FUEL related issue but more of a database connection issue. To rule out FUEL, I'd create a test script:
    http://php.net/manual/en/function.mysqli-connect.php
  • Can you get an SSH connection to your server? Does CLI access via the mysql command work?
  • Hi! THe DB issue was fixed. The error was about a mistake over the "production" base url.
    That was solved.

    Now the problem is something about htaccess rewriting urls and paths because the website is deployed under an "app" folder. But trying to change the INSTALL_ROOT to "/app/fuel" and/or using Rewritebase to /app/ the website doesn´t work.

    Check the url again to see the error.

    I have ssh access.

    Thanks !!
  • I´am trying to put to work this stuff ! :)

    The heroku env have a bootstrap file that initializes the Apache server:
    https://github.com/heroku/heroku-buildpack-php/blob/master/conf/apache2/heroku.conf

    I think the problem is with the HEROKU_APP_DIR and DOCUMENT_ROOT. When I access trough the bash i can see the traditional fuelcms folder structure, but i can go up one level and all these folders are under an "app" folder:

    app
    -- fuel
    -- assets
    -- index.php
    -- .htaccess
    -- etc

    I think the problem is between .htaccess and that app folder. I did a lot of tests adding a apache conf file setting the documentRoot to "app/" but without success.

    Thanks!

  • What is the error you are seeing?
  • Forbbiden page (404) is the error.

    But the 404 error i´am getting is the provided by the framework. So, this is working well.

    I think the error is here: http://docs.getfuelcms.com/general/opt-in-controllers ( when the router is going to search the view ) so he is showing the codeingiter 404 default page.

    URL: enigmatic-anchorage-61301.herokuapp.com

    Thanks!!
  • What's the URL you are trying to get to? Is it the fuel admin (e.g. /fuel)? If so, do you have the fuel/application/config/MY_fuel.php $config['admin_enabled'] = TRUE? Also, does your server support .htaccess and mod_rewrite? One way to check would be to use index.php/fuel instead.
  • Yes, i´am trying enigmatic-anchorage-61301.herokuapp.com/fuel and Yes, i´am trying enigmatic-anchorage-61301.herokuapp.com/index.php/fuel .

    It supports htaccess and mod_rewrite.

    admin_enabled is set to "true".

    Thanks!
  • It does indeed appear to be hitting the framework side of things and is returning a CI 404 error which looks like it is getting hung up in the fuel/codeigniter/core/CodeIgniter.php file somewhere.

    Are you able to deploy a regular CodeIgniter website?
  • Yes, here is an example: https://github.com/phalconVee/codeigniter-heroku-app

    In the above example, i can see now the "system" folder is at the root level of the folder structure.

    May be the issue is it?
  • Tough to say. Are you able to debug the CodeIgniter.php file to see what where it's hitting the 404 error?
  • Sure. What do you have in mind?
  • Well, one way would be to simply put in exit(); commands at different parts of the CodeIgniter.php file to see where the show_404() is being called.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!