Run python and php in a single heroku app procfile - php

I haven't been able to find a way to launch two web workers for separate language types in a single Heroku app.
I have a python app running well, and I've added a PHP app in a folder, so my procfile ideally would look something like this:
web: python pythonapp.py
web: sh phpapp/index.php
Of course this doesn't work, in fact even if I remove the python worker altogether I can't get the PHP app to run via procfile. The logs just show that it's crashed and "Syntax error: "(" unexpected"
If I just load the PHP app into a Heroku app without a procfile, it runs fine.
So the question is: How to initiate a PHP app via the procfile rather than relying on Heroku to autodetect PHP?
Thanks,
-James

For anyone who ends up here years after the thread was started (2020 for me), Heroku now has builtin multi buildpacks. Use this link for info and how to setup:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
(Note: I got this link by starting with Kenneth Reitz's answer above).

It sounds like these applications should be split into two separate codebases.
However, you can achieve this with the multi-buildpack:
https://github.com/ddollar/heroku-buildpack-multi

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

Is it possible to deploy a PHP remote git with Cloud Shell in Google cloud?

After reading several webs and google cloud documentation, I start thinking that is not possible to deploy a PHP git repo https://github.com/GoogleCloudPlatform/getting-started-php.git directly from Cloud shell.
In every tutorial, and in the documentation they always say you need the gcloud SDK to run it locally, but how about directly from Cloud shell?
The idea is to make work a PHP hello world example like the one in https://github.com/GoogleCloudPlatform/getting-started-php/tree/master/1-hello-world but I'm having problems with the runtime. Official tutorial
In env: flex, only the following runtimes are allowed:
('python-compat', 'java', 'java7', 'go', 'custom')
After reading I might be missing something related to docker file or composer.json, I did tests with this last one but without success so if there's a way it might be with docker file.
But while I continue investigating I wanted to know if it's possible and if I'm missing something.
Thank you!

Heroku - Can I define a Procfile for a Laravel 5 app using the Laravel built-in server (not Apache)?

Most Laravel tutorials define a Procfile on the production step with the following contents:
web: vendor/bin/heroku-php-apache2 public/
But I'm wondering if there is a way to use the Laravel built in server instead? You would do this locally by calling php artisan serve on the command line, but how would I configure the Procfile in this case?
I ask because I wasn't able to get Laravel to work properly without calling php artisan serve on the command line. Although I've found incriminating info which states that this server isn't meant to be used for production (I'm really missing Rails' rails server now).
I've tried the following:
web: vendor/bin/heroku-php-artisan-serve
And of course it doesn't work because there isn't an executable with that name in the bin folder. What is the correct way to go about doing this? Or is this a bad idea?
Simply:
web: php artisan serve --port=$PORT
But that is not a good idea, because it uses PHP's built-in development server, which handles just one request at a time.

Laravel - how to serve a new laravel project to browser

This is the first time I've used a PHP framework.
I've been following the Laravel documentation to install Composer and Laravel, and everything seems to have gone smoothly.
But now I've finished the installation/configure instructions, and I have created a project, I can't see any instructions on how to serve my application so it's viewable via a browser?
I have used Ruby on Rails before, which came with an easy way to get an instance of the application running via a built-in web server.
Is there something similar with Laravel, or do I need to somehow configure my standard Apache instance to serve the application?
I'm guessing there is something I've overlooked or misunderstood in the documentation.
yes, you can do it by using following in your terminal.
open your terminal, and navigate to directory where you have your project abc
and fire following command
php artisan serve
Now you can access it in browser by going to http://localhost:8000
hope you get it
I just want to add to the answer of Mubin Khalid . You can choose your own port number like
php artisan serve --port=8080
This is helpful when running two or more project.
You can also serve with you ip address
php artisan serve --host=ip_of_computer_running_laravel --port=8080
works to access server with in same network.
if you are accessing from same laptop you can just browse to ip_of_computer_running_laravel:8080 but if you are browsing from other computer in the network ip_of_computer_running_laravel:8080

Running php in node on Heroku

I know this is very wrong. I have a project running on node on Heroku. I have a php script that is long and complex and I don't want to rewrite it. I was going to setup another server but that would cause some CORS/XSS problems.
My question is, is it possible to run a small php script in Node on Heroku?
I know this is bad practice but it is a one time thing.
You cannot do this by default, because when you deploy a node app you'll be using the Node buildpack from Heroku. What you can do instead is this:
Write your PHP script as a web API, and deploy this to it's own Heroku app. Then, in your Node app, make an HTTP call to your PHP API on Heroku so it does what you want =)

Categories