Running php in node on Heroku - php

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 =)

Related

Bundling Electron JS with laravel and sqlite

I developed a desktop application in react and electronjs. And built an API with laravel, eveything works perfectly. The challenge I have is, how I can deploy and run my electron app locally without having to manually setup the laravel API.
I am looking for a way to have all of this setup and installed once. I checked out a couple of options and one of such is php-server but that wasn't still going to cut it.
Shell Scripting
I have thought about executing a shell script to create the server instance pull my laravel application from github, set it all up on docker.
The challenge is, if any of my users run docker ps they would see all the processes running on my docker instance.
A possible solution would be isolating docker so it's not accessible globally but only within the application.
I don't know how to achieve this.
If this is achievable please drop some guide on how to achieve that or maybe suggest a better way to handle my current situation.

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 can I run app tests that use Google App Engine PHP SDK functions from the command line

Is it possible to load the GAE PHP SDK via composer or some other method so I can run SDK functions outside of the development server? Right now I have a php app that uses some of the functions to generate image urls. The app works fine when running from a browser in the dev server or pushed into production but I can't run functional tests via the command line. Is there a simple way to fix this?
While not documented, hence not (yet) supported, there's a php_cli.py script under the SDK root that will do exactly what you want.

How to configure TFS build-definition for continous-intergration for a PHP-Project on Windows Azure Webrole?

I am running a PHP Project (Drupal-Multisite-Enviroment) on Azure web-role with WindowsAzurePHP SDK. Everything works pretty fine. Now I want to implement continuous-integration with TFS and i am wondering, if anybody has ever done it before, because i can't find any documentation about it.
I understand that the deployment process on Azure is connected to the build process on TFS. But what is the output of that azure-specific build-process? The deployment package *.cspkg and ServiceConfiguration.cscfg?
If so, do i just have to make a custom Build, that moves PHP files to a temp folder, calls the Azure SDK package-batch and pushes the package to Azure cloud afterwards?
I would appreciate it if you would share your experiences with me.
I have not done it before but yes... If you set your solution to build in Team Build you should get the Azure specific output only.
The easiest to get your PHP into the right place is with a pre or post build PowerShell.
https://github.com/tfsbuildextensions/CustomActivities/blob/master/Source/Scripts/GatherItemsForDrop.ps1
You should be able to use this PowerShell after build to put together your PHP with your azure bits that just got built.
Then create a post test PowerShell to deploy to Azure.
You can set PowerShell scripts to run by editing the build definitions and on the process tab opening the "advanced" sections.
Note: Make sure that you are using DefaulTemplate.12.xaml.

Run python and php in a single heroku app procfile

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

Categories