`git push heroku master` returns error - php

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.

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"

Pushing Laravel App to heroku fails - valid cache path error

I'm trying to push a test Laravel application to Heroku but whenever I try to do so I get an error and the deployment stops. This is whats displayed when I do a deploy:
remote: Generating optimized autoload files
remote: > Illuminate\Foundation\ComposerScripts::postInstall
remote: > php artisan optimize
remote:
remote:
remote: [InvalidArgumentException]
remote: Please provide a valid cache path.
remote:
remote:
remote: Script php artisan optimize handling the post-install-cmd event returned with error code 1
remote: ! Push rejected, failed to compile PHP app.
remote:
remote: ! Push failed
remote: Verifying deploy...
What's the issue here? The storage/framework folder has all the needed folders and they're included in the repository. So whats wrong here?
Just check the gitignore file if has /storage/.key or /storage/ remove it and again run commit and push.

Heroku Push rejected, failed to compile PHP app

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!

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.

Heroku won't accept push due to submodule

I've created a PHP app on heroku, and I installed the sendgrid-php submodule. However, when I try to push it, this occurs:
$ git push heroku
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
-----> Git submodules detected, installing
Submodule 'sendgrid-php' (https://github.com/sendgrid/sendgrid-php) registered for path 'sendgrid-php'
warning: templates not found /app/vendor/share/git-core/templates
Initialized empty Git repository in /tmp/build_wfcgkfb0p50x/sendgrid-php/.git/
fatal: reference is not a tree: 3f145137608a98b09eb01d447ff9d31d161ef2a2
Unable to checkout '3f145137608a98b09eb01d447ff9d31d161ef2a2' in submodule path 'sendgrid-php'
! Heroku push rejected, Submodule install failed with exit code 1
To git#heroku.com:gausschain.git
! [remote rejected] master -> master (pre-receive hook declined)
I've also configured the SendGrid addon for Heroku. Any ideas as to how I can resolve this?
That means in actual submodule
SHA1 - 3f145137608a98b09eb01d447ff9d31d161ef2a2
has not been pushed yet. but in .gitmodules file this SHA is recorded on that specific branch
It sounds to me like you're actually doing something wrong. The recommended way to install the SendGrid PHP library is using composer. You should have a look at the README for details on doing that.
There is a PHP Heroku Buildpack that has composer support. Here is a tutorial to get you started:
http://cloud.dzone.com/articles/using-composer-manage

Categories