30

Thank you for taking the time to review my request for help.

I've been using gh-pages to work on a build for a static site and the server has worked amazing for me throughout the build!

Although I seem to have an issue when submitting my HTML web form to my email through PHP code. When I submit to the gh-pages server I get this error message saying *405 not allowed ngix* I've been digging around to find an answer to this. First I discovered that I did have a few minor errors in my code which I fixed. Then I submitted again to the server with the correct code and still received the same message from the gh-pages server. *405 not allowed ngix* this leads me to believe that the gh-pages server does not support any PHP code.

I found some information on SO about the gh-pages server not supporting PHP. How to publish .php page instead of .html at github to demo some php content?

screen shot 2014-12-27 at 12 44 19 pm

enter image description here Server side includes alternative

Does PHP run on gh-pages? Or not?

If not then I know that everything on my side is correct and I should not worry about it because when I truly deploy this site live I'll use a server that does support PHP.

Here's my current build so you can test out my issue. http://kapena.github.io/pp_web/#contact-pp

This is what I am getting when I submit the form to the server..

enter image description here

mteam88
  • 103
  • 1
  • 12
brent_white
  • 1,009
  • 1
  • 13
  • 26
  • 2
    I'm 90% sure it only supports HTML & JavaScript, not PHP. – Daryll Doyle Dec 27 '14 at 23:13
  • @DaryllDoyle yeah that's what I think so to..Just emailed git hub on this issue. Best way to get the answer is just go straight to the source of it :) – brent_white Dec 27 '14 at 23:16
  • What I've done in the past is to run a github action that commits back you your repo: Steps: 1. Commit your_page.php to repo 2. action runs php your_page.php > your_page.html 3. action commits your_page.html to repo 4. page is live this would work with something like php include for headers and stuff, which is exactly what i used it for previously, but not any execution server side. edit: I used to to it via oneliner in netlify: mv index.html index && php index > index.html – sturlabragason Dec 08 '21 at 15:08

3 Answers3

32

A static site cannot by definition support PHP.

  • Static websites serve content directly from the web-server’s file-system exactly as stored.

  • Dynamic websites generate content live per each request. The request is delegated to a running web-application that builds the content.

What is a Static Website

You might be interested in PieCrust. It is a static site generator.

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
Zombo
  • 1
  • 62
  • 391
  • 407
9

Github pages currently do not support PHP as it only supports static website.

However, if you want to display some dynamic content on your website, you can simply use iframe to display that content, but again it has to be hosted somewhere else.

Here is something that might be helpful to you: Guide to use Github Pages

Aditya Jain
  • 129
  • 1
  • 5
0

No, but they do support embedded PHP: You embed a page into GitHub pages, and the page has PHP hosted on other hosting sites.

norway-yv
  • 222
  • 2
  • 12
OctonalXX
  • 49
  • 9