Heroku Push rejected, failed to compile PHP app - php

Deployment to Heroku for my project has been working fine until today. Last update to my composer file was including a php class to my class map in composer.json. Now Heroku Deployment fails with this error message
-----> Removing .DS_Store files
-----> Fetching custom git buildpack... done
-----> PHP app detected
-----> No runtime required in composer.json, defaulting to PHP 5.6.11.
-----> Installing system packages...
- PHP 5.6.11
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
! Push rejected, failed to compile PHP app
I have tried updating composer, but updating composer.lock doesn't solve this issue for me.
Any help would be appreciated.

Heroku is having problems at the moment: https://status.heroku.com/incidents/792
Don't worry, it's not just you!

Related

Azure php Error Deployment from local git - using tutorial

so I'm new to azure deployment and I try my best to use the microsoft documentation tutorial
https://learn.microsoft.com/en-us/azure/app-service/tutorial-php-mysql-app?pivots=platform-windows
everything is fine until "Deploy to Azure" Step in :
git push azure main
remote: [ErrorException]
remote: Trying to access array offset on value of type null
remote: An error has occurred during web site deployment.
remote:
remote: composer failed
remote:
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://phpmysqldemogs.scm.azurewebsites.net/phpMysqlDemoGS.git
The log detail from Deployment Center > Logs show I have failed commit with detail log
Command: bash deploy.sh
Creating app_offline.htm
KuduSync.NET from: 'C:\home\site\repository' to: 'C:\home\site\wwwroot'
Deleting app_offline.htm
Running composer install
[ErrorException]
Trying to access array offset on value of type null
An error has occurred during web site deployment.
composer failed
[ErrorException] \r\n Trying to access array offset on value of type null\r\nC:\Program Files (x86)\SiteExtensions\Kudu\95.30831.5373\bin\Scripts\starter.cmd bash deploy.sh
I tried to push again, it says "already up to date"
I tried to clone repo from azure, do composer install then php artisan serve ... it worked locally, so I assume that the problem is in deployment configuration. Can anyone help the production problem?
Thanks in advance.
This error Error - Changes committed to remote repository but deployment to website failed. occurs when you push a local branch that doesn't match the app deployment branch on 'azure'.
To resolve this error, Verify that the current branch is master. To change the default branch, use DEPLOYMENT_BRANCH application setting (refer to Change deployment branch).
You are also getting Trying to access array offset on value of type null error and that is failing composer.
To resolve this error, you need to updater the composer.
composer update
OR
php composer.phar update
You can refer to Troubleshoot deployment and Error "Trying to access array offset on value of type null"

`git push heroku master` returns error

I am trying to create a simple project on Heroku by pushing a git which contains only a php ('Hello World') file, am empty README file and an empty json file.
When I enter git push heroku master in the terminal to do this I (partly) get the following response:
remote: ! Push failed due to an unrecognized error, and we've been notified.
remote:
remote: ! Please try pushing again.
remote: ! If the problem persists, see http://help.heroku.com/ and provide Request ID *my_project_id*.
remote:
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to *my_project_name*.
remote:
To https://git.heroku.com/*my_project_name*.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/*my_project_name*.git'
Because of this I cannot properly run any new Heroku app (which may include only a php 'Hello World' file).
This error was presented suddenly after I have already used successfully git push heroku master for dozens of heroku apps (the same day).
Actually, this error was presented to me also when I tried to edit an app which was already running properly.
How can I fix this?
I am pretty sure that I was affected by deployment failures occurring on Heroku itself and it was not anything about what I did which caused this error.
When something goes wrong I tend to think that I am doing something wrong but sometimes it may be that something wrong is occurring at the other side of my computer.

Application error on heroku - No 'composer.json' found

When I try to access my heroku page it says
"Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details"
This is my build log:
PHP app detected ! WARNING: No 'composer.json' found. Using
'index.php' to declare app type as PHP is considered legacy
functionality and may lead to unexpected behavior. Bootstrapping...
Installing platform packages... NOTICE: No runtime required in
composer.lock; using PHP ^5.5.17 apache (2.4.20) nginx (1.8.1) php
(5.6.30) Installing dependencies... Composer version 1.4.1 2017-03-10
09:29:45 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: 13.9M Launching... Released v119 deployed to
Heroku Build finished Blogs Careers Documentation
========================================================================

Laravel + git, contributors have different environment

Me and my coworker are trying to use local git repo for our Laravel project.
I am using Ubuntu, with PHP 5.5.9-1ubuntu4.9, and he is using Debian with PHP 5.4.39.
When I pulled his committed version, I get an error when trying to run composer update:
user#ubuntu:/var/www/frontend$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182
Script php artisan clear-compiled handling the post-install-cmd event returned with an error [RuntimeException]
Error Output: PHP Fatal error: Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182
We have vendor folder on git, since not having it isn't an option for us.
I guess the problem is different php versions. Is there a way of setting up php version manually, so composer gets the right dependencies?
you can set php version in composer.json file in require portion
"require": {
"php": ">=5.3.0",
},
The problem was probably this:
User checked in the project, including the vendor folder.
Later vendor somehow got added to .gitignore
Nobody noticed that new files were not being added to the repo and magic made sure everything still worked as it did :D

Heroku doesn't recognize my Laravel app as PHP app, and does not do composer install

I'm trying to publish my Laravel app on Heroku.
I have excluded the composer.lock file from .gitignore, and created a Procfile containing
web: vendor/bin/heroku-php-apache2 public
I created my app with
heroku create myapp;
git push heroku master;
Then I get the following output:
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags heroku master:master
Pushing to https://git.heroku.com/myapp.git
POST git-receive-pack (1914 bytes)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: -----> Resetting git environment
remote:
remote: PRO TIP: Specify a node version in package.json
remote: See https://devcenter.heroku.com/articles/nodejs-support
remote:
remote: -----> Defaulting to latest stable node: 0.10.35
remote: -----> Downloading and installing node
remote: -----> Exporting config vars to environment
remote: -----> Installing dependencies
remote: npm WARN package.json myapp#0.0.0 No repository field.
remote: -----> Cleaning up node-gyp and npm artifacts
remote: -----> Building runtime environment
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing... done, 9.6MB
remote: -----> Launching... done, v5
remote: https://myapp.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/myapp.git
5b1c663..0dff021 master -> master
updating local tracking ref 'refs/remotes/heroku/master'
Completed successfully
If I browse to my app, however I get an application error.
When I look to my logs, it says
app[web.1]: bash: vendor/bin/heroku-php-apache2: No such file or directory
I suspect that somehow, Heroku didn't do composer install, as it's not in my git output, and maybe it didn't even recognize that my app is an PHP app?
To be sure, I also included an empty index.php file in my root. Didn't help.
What am I missing here?
I believe I found it. Should better read the lines ("Node.js app detected").
Solved by firing this command :
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
and pushing again
Haha, just simply drop the package.json in your laravel project.
And then Heroku will detect your app as a php project.
Be sure to include the trailing slash on public: public/. This was my issue - I am using Laravel and got a Image source not readable and NotReadableException in AbstractDecoder.php line 302: because it thought at AbstractDecoder->init('/app/public') in AbstractDriver.php line 64 was a file, not a folder.

Categories