Deploying existing PHP app from Github not recognising enviroment - php

I'm trying to deploy my PHP app hosted on github to heroku. Unfortunately heroku doesn't recognise it as PHP and uses default Nodejs setup. I made sure i have composer file in the root directory as specified by heroku documentation page. I also copied Procfile from their example app. Wonder if anybody have an idea why heroku doesn't recognise my app as PHP?
UPDATE
If i push the project from my machine directly to heroku, everything works as intended.

Creating a ticket with heroku support revealed that once my app was recognised as nodejs wouldn't change automatically to PHP (I had a package.json file in my project which made it to look like nodejs app to heroku, and removing it wouldn't help). Simply creating new heroku app, without package.json file solved the problem.

You need to set the correct buildpack before pushing to heroku:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php
does the trick.

Related

My heroku app has no dynos running - No web processes running means Application error when opening hosted website

I deployed my app on Heroku it doesn't work so when i checked out the app in Heroku website i've noticed that it has no dynos and it's supposed to be having one dyno by default if no Procfile detected.
That's what i've been doing the most of the time previously and it was working fine
Heroku logs says:
No web processes running
it has no Procfile only some images css and HTML.
Finally, i was stuck in that for like 3 hours or more thank god it's fixed... fixed just by deleting the whole heroku app and then specifying the buildpack that you gonna use in your interactive terminal with this command line heroku buildpacks:set heroku/php and you can add it on creating the app directly and that's what i did and it was fixed like that:
heroku create myapp --buildpack heroku/php
and the main reason was because of one python library was installed and i wasn't even using it so heroku finds two builpacks python and php and used the python one so when i did specifying that i'm actually using PHP everything works fine
i'd like to document it in public so others (including me) can find it later. Now, others can benefit from my misfortune LOL

How to push new local dependencies to shared hosting with Laravel?

My website is running smoothly with Laravel in a sub-domain, but now I have added a new dependency https://github.com/PHPOffice/PHPExcel to my local project using composer require phpoffice/phpspreadsheet.
The code is already working fine in my local environment, but now I need to push my new changes to the website.
Pushing the controllers, routes, views, etc it's easy, but how do I push the dependency?
I have full access to the cPanel
I can create SSH keys
The project is running in a sub-domain
I'm using Visual Studio Code
I have generated a private and public key for SSH
I have initially deployed my Laravel project to the server using FTP Filezilla
For what I have read so far, I should be using SSH with PuTTY, but if I could use an extension in Visual Studio Code, would be great.
Composer stores all the imported libraries in the /vendor folder. When you push your local copy of the website up, it will push up the vendor folder and you'll be set.
If you're working on a remote server and you need to still download the dependencies, run
php composer.phar update
That will download the dependencies for the project. You'll need to run it from the command line (ssh) and be in the website directory.
Some companies don't allow ssh access to the server. In that case, you can run php composer.phar update on your local machine, assuming you have a php runtime install (WAMP, XXAMP, ect). Then when you push or copy your code to your server, the libraries will be included.
Well I can create SSH keys but don't have access to login with them. With that said I follow the tutorial here https://laraveldaily.com/laravel-and-shared-hosting-working-with-ftp-and-phpmyadmin/ that teaches how to use FTP to upload/update the application.

How to update Wordpress files on Heroku?

I successfully deployed a Wordpress website on Heroku.
Here is what I did:
Download wordpress
Push all file on a Github repository
Create Heroku app
Link Heroku app to Github repository
Create clearDB database and update to wordpress config file
Deploy
Everythings is working fine. But whenever I update a file on the github repository and redeploy the heroku app, all user generated content are getting overwritten such as plugins and media contents.
How can I update my wordpress source code without losing any content?
Heroku has an ephemeral file system, meaning that any files that are saved to the Heroku instance while running, will be removed on your next application push. This is why there aren't many easy buildpacks for WordPress. All files "added" to your app have to be hosted elsewhere, like S3. Which makes it not necessarily ideal for a WordPress app without significant modifications.
I use Heroku for a lot of our infrastructure, but for WordPress sites I use Flywheel. (http://getflywheel.com) They have great support, have a handy local app that harnesses a virtual machine that is virtually identical to their live builds, and support intelligent Staging environments. I use DeployHQ to automate the build process similar to how Heroku does it. Pushing my repo will trigger a DeployHQ build to push code to Staging or Production, without affecting any user uploaded content/etc.

I can't deploy my php app to Heroku

This is the first time I get in touch with Heroku (it's really amazing).
I followed these steps to deploy my very first app to heroku.
git init
git add .
git commit -m 'first commit'
heroku create abcfirstapp
git remote add origin git#heroku.com:abcfirstapp.git
git push heroku master
And I got the error like
Heroku push rejected, no Cedar--supported app detected
To git#heroku.com:abcfirstapp.git
[remote.rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:abcfirstapp.git'
I'm quite sure that my php file is written probably since it runs well with my local xampp server
<?PHP phpinfo(); ?>
One more problem is: when I try to pull from heroku using
git pull heroku master
I got an error
fatal: couldn't find remote ref master
Could anyone help me out please?
Thanks
The default PHP buildpack detects PHP apps by looking for index.php in the repo root. Do you have one of those?
Alternatively, you can hardcode the buildpack:
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
no Cedar--supported app detected
PHP is not a natively supported language on Heroku, outside of Facebook apps I suppose. You'll need to utilize something like a Third Party Buildpack.
It looks like the docs (Apr 2015) recommend you set a custom buildpack via:
heroku buildpack:set https://github.com/heroku/heroku-buildpack-php
https://devcenter.heroku.com/articles/buildpacks
What is required is at least an empty composer.json push this, and re-deploy

Cannot install Heroku on Win7, getting error "/bin/env: ruby: No such file or directory"

I am trying to install Heroku for a facebook app. When i try to run $ heroku login as it says here: http://devcenter.heroku.com/articles/facebook#heroku_account_and_tools_setup I get the following error:
/bin/env: ruby: No such file or directory
I don't even want to use ruby, I need php. I don't have php/ruby installed. Can you help me?
Here is what you could do
Download heroku toolbet
Download TortoiseGit
Setup SSH keys, you can use putty agent
Git Clone the new heroku app you made using tortoisegit
Make changes on your folder
Commit your changes
Push the changes
Test the app via adding it on a facebook page
Its not as easy as it looks but it has to be done this way unless you have an https server.
There are documentations there that could help you out.
Good luck :)

Categories