Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP站点不再在Heroku上工作:错误500_Php_.htaccess_Heroku_Cleardb - Fatal编程技术网

PHP站点不再在Heroku上工作:错误500

PHP站点不再在Heroku上工作:错误500,php,.htaccess,heroku,cleardb,Php,.htaccess,Heroku,Cleardb,我正在尝试将我用香草PHP7.2.1编写的应用程序推送到Heroku。我已经用apache和mariaDB在一个本地docker容器中进行了开发,一切正常。当我转到Heroku时,会加载索引页,但是如果我尝试登录或转到任何其他页面,都无法正常工作,我会得到一个空白页面。我使用clearDB加载项并通过CLI将我的mariaDB.sql导出文件导入其中。该网站使用URL重写、路由器和.htaccess 我已经通读了这里的其他问题,似乎这个问题可能来自多个角度。不幸的是,我对很多这方面都是新手,我很

我正在尝试将我用香草PHP7.2.1编写的应用程序推送到Heroku。我已经用apache和mariaDB在一个本地docker容器中进行了开发,一切正常。当我转到Heroku时,会加载索引页,但是如果我尝试登录或转到任何其他页面,都无法正常工作,我会得到一个空白页面。我使用clearDB加载项并通过CLI将我的mariaDB.sql导出文件导入其中。该网站使用URL重写、路由器和.htaccess

我已经通读了这里的其他问题,似乎这个问题可能来自多个角度。不幸的是,我对很多这方面都是新手,我很难理解错误日志。我认为这些(或全部)中的任何一个都可能是错误的:
  • 由于.htaccess而可能出现的问题
  • 缺少composer.json文件,因此服务器端配置错误
  • 数据库与应用程序的连接方式可能存在冲突

    根据以下信息,我可以/应该尝试对应用程序进行哪些故障排除

    这是我的.htaccess:

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9-_/]*)$ index.php?id=$1 [QSA,L] 
    
    这是生成日志:

    -----> 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
    
    这是应用程序日志:

    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
    
    可能的重复可能的重复可能的重复