Using PHP -Reference

Two ways to use PHP on Glitch for personal reference.

1 Allow PHP in your glitch.json

{
  "install": "echo 'We Are Ready!'",
  "start": "php -S 0.0.0.0:3000 -t ."
}

2 php-poc

Use the “SlimFramework” on php-poc: https://glitch.com/~php-poc

2 Likes

@MindsGaming, that info is useful and for more people to notice it, I’m moving this to #the-gallery! And also a correction, you need to add that piece of code in the glitch.json not the package.json!

1 Like

I can find this and add it.

glitch.json can be described more simply:

{
  "start": "php -S 0.0.0.0:3000"
}

If you need a directory, use the -t option:

{
  "start": "php -S 0.0.0.0:3000 -t public/"
}

I have published this project as a sample:

There may be some more tips:
https://www.php.net/manual/en/features.commandline.webserver.php