Cannot use php in glitch

I’ve been trying to use PHP in glitch, I’ve searched about the topic and some say yes and some say no, I’ve also seen some PHP projects in glitch, but I’m not able to reproduce them, when I upload a php file as example, it goes to assets and cannot get imported to my website.

Kind of off-topic but yes, I know it’s a good namesnipe.

1 Like

You need a way to tell glitch which is your starting file, this is normally done in package.json, so in the examples look for that or a similar kind of file.

1 Like

@mishavee is correct in that you need some way to tell Glitch what to do when your project starts up. The existing PHP examples largely use a glitch.json file which is an alternative to package.json but for non-Node projects. Additionally you need some sort of server to run your PHP code, since Glitch assumes that Node is your server. Most of the examples I’ve worked with include specific Apache web server information in the project, so starting out by Remixing one of those projects makes sure you’ve got those additional required files - otherwise Glitch doesn’t know what to do.

I’d suggest Remixing one of the projects in to give you a solid starting point.

Hope this helps!


@cori We really don’t need to install Apache and PHP?

They’re already installed in the container, which is largely just a little Ubuntu server:

app@hip-crab:~ 13:39 
$ which apache2

app@hip-crab:~ 13:39 
$ which php

The projects I pointed to for remixing already have some of the boilerplate config done, that’s all.

1 Like