0

I'm trying to push an app that I wrote in vanilla PHP 7.2.1 to Heroku. I've developed in a local docker container with apache and mariaDB and things work fine. When I go to Heroku, the index page loads, but if I try to log in or go to any other page, nothing works and I get a blank page. I use the clearDB add on and simply imported my mariaDB .sql export file in there through CLI. The website uses URL rewriting, a router and a .htaccess.

I've read through other questions here and it seems like the problem could come from multiple angles. Unfortunately I'm new to a lot of this and I struggle understanding the error logs. I think either of these (or all) could be wrong:

  • possible issues due to the .htaccess
  • lack of composer.json file, so the server end of things is configured wrong
  • maybe a conflict in how the database is connected to the app
  • Based on the information below, what could / should I try to troubleshoot the app?

    This is my .htaccess :

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9-_/]*)$ index.php?id=$1 [QSA,L] 
    

    This is the build log:

    -----> PHP app detected
    
     !     WARNING: No 'composer.json' found!
     !     Your project only contains an 'index.php', no 'composer.json'.
     !     Using 'index.php' to declare app type as PHP is deprecated and
     !     may lead to unexpected behavior.
     !     Please consider updating your codebase to utilize Composer and
     !     modern dependency management in order to benefit from the latest
     !     PHP runtimes and improved application performance, as well as
     !     control over the PHP versions and extensions available.
    
     !     For an introduction to dependency management with Composer and
     !     how to get the most out of PHP on Heroku, refer to the docs at
     !     https://getcomposer.org/doc/00-intro.md and
     !     https://devcenter.heroku.com/articles/getting-started-with-php
    
    -----> Bootstrapping...
    -----> Installing platform packages...
           NOTICE: No runtime required in composer.lock; using PHP ^7.0.0
           - php (7.3.11)
           - apache (2.4.41)
           - nginx (1.16.1)
    -----> Installing dependencies...
           Composer version 1.9.0 2019-08-02 20:55:32
    -----> Preparing runtime environment...
           NOTICE: No Procfile, using 'web: heroku-php-apache2'.
    -----> Checking for additional extensions to install...
    -----> Discovering process types
           Procfile declares types -> web
    -----> Compressing...
           Done: 18.5M
    -----> Launching...
           Released v5
           https://cogip-becode.herokuapp.com/ deployed to Heroku
    

    This is the application log:

    2019-11-08T12:59:03.464108+00:00 heroku[router]: at=info method=GET path="/assets/css/style.css" host=cogip-becode.herokuapp.com request_id=527c0174-09a9-42c9-9a08-4253b4baa78d fwd="84.198.194.106" dyno=web.1 connect=1ms service=1ms status=304 bytes=128 protocol=https
    
    2019-11-08T12:59:08.532874+00:00 heroku[router]: at=info method=POST path="/" host=cogip-becode.herokuapp.com request_id=d7eea251-3d27-49c5-bd54-75d9583b3dd4 fwd="84.198.194.106" dyno=web.1 connect=1ms service=3ms status=500 bytes=279 protocol=https
    
    2019-11-08T12:59:08.533394+00:00 app[web.1]: [08-Nov-2019 12:59:08 UTC] PHP Notice:  Undefined index: id in /app/index.php on line 4
    
    2019-11-08T12:59:08.533891+00:00 app[web.1]: [08-Nov-2019 12:59:08 UTC] PHP Parse error:  syntax error, unexpected 'cleardb' (T_STRING) in /app/database/connection.php on line 3
    
    2019-11-08T12:59:08.534564+00:00 app[web.1]: 10.11.238.43 - - [08/Nov/2019:12:59:08 +0000] "POST / HTTP/1.1" 500 - "https://cogip-becode.herokuapp.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:60.9) Gecko/20100101 Goanna/4.4 Firefox/60.9 PaleMoon/28.7.1
    
    Octa
    • 11
    • 1

    0 Answers0