I’m trying to deploy an index.php file to my GitHub Pages site, but I have absolutely no idea how-to! Any pointers?
- One of the first results: https://help.github.com/articles/what-is-github-pages/
- Quote from page: “GitHub Pages is a static site hosting service and doesn’t support server-side code such as, PHP, Ruby, or Python.”
I’ve realised that it doesn’t provide default PHP hosting :smiley: It’s just that I was wondering if there is anyway to host PHP on GitHub - be it using a script or something (I honestly don’t know, I’m barely a developer)?
According to the GitHub ToS (https://help.github.com/articles/github-terms-of-service/) section I:
- ”This hosting service is intended to host static web pages for GitHub users.”, PHP is not static
- You should follow the GitHub Pages guidelines, and as you can see in my previous post these guidelines say again that PHP is not availible
So you can’t run PHP without violating the ToS.
Thanks for your thoughts, and for quoting that excerpt of the GItHub Terms of Service.
Of course, just to be clear, you CAN host php scripts, and essestially anything, in a github REPO.
It is not working. When load php page getting download prompt for the file.
Is it working for you?
Did you read the thread? You surely can host the PHP file in GH repos as a static file but it won’t execute on the GH Pages platform.
What would you guys recommend to use instead?
Why do you even want to host your PHP site on Github when you have proper servers like DigitalOcean, AWS and others. If it is the server hassles that you want to avoid, then there are services that provides managed PHP site hosting on these servers. As for github pages, I don’t think it supports non-static sites.
No, you cannot do that on Github Pages as it only supports static websites, i.e. sites built on html, css, JS.
You can add php file in github repo, but it won’t execute or compile your php code this is the same with google drive
umm if i put a single cgi file? will work?
@mckaygerhard No, it won’t. Read the thread - hosting PHP both isn’t possible and isn’t allowed on GitHub pages.
You however can, and should, host your PHP code with GitHub.
How to do this, this is what I’m looking for. Any links or something…
I badly want the github.io to be my main portal as it sounds cool and professional. lol. All I need is for my website to be maintainable and dynamic.
Hi @designdust ,
However, if you have any ideas about what kind of technologies/frameworks you’d like to use, we may be able to offer a few tutorials that better fit your needs.
Presenting the project in GitHub Pages using php is not - as mentioned in the previous response regarding ToS.
As also mentioned:
Deploying php source to GitHub for project management, and even posting to the destination hosted server is possiible. Nothing in GitHub prevents this.
For me, this was the solution to the conundrum:
Alternate Solution: Don’t use GitHub Pages for working with php projects.
- Develop php locally using an OracleVM Virtual Machine configured to match your hosting server resources.
For me it was what to me seems alterately referenced as a LAMP or LEMP stack.
(Google “how to create an Oracle VM LAMP stack” for examples using your favorite Linux flavor).
- Use Git to manage the project files to be pushed to your registered domain on demand.
- When you need to make changes to the live site - create a pull request and merge.
Hope this helps!
Hi, Github pages only provides static page hosting. You need to buy a web hosting or Vps server for this. PHP needs a server to run the php pages. On localhost you have the option of internal servers in frameworks.
Here’s a pointer