I can understand why you wouldn’t want to use codepen and the like (although their professor view seems perfect for you, students work should be visible to teachers but not to other students), but you should understand it’s a lot of work. From the about page I can see 3 people worked on codepen, one dedicated front-end developer, one dedicated back-end developer and one jack of all trades. That’s probably aiming too high for a one-man project.
That said something far less complex would be enough to fit your needs and I wish you good luck. You don’t need PHP and Ruby, it’s one or the other. I would however look into a framework like Zend Framework 2 (there are tons of others, probably more lightweight. ZF2 needs more work to make it fast. I don’t know anything about Ruby but I think Ruby on Rails is a framework…? )
You should know what you’re getting yourself into, it’s a lot work and time that you could have better spend elsewhere. I’d reconsider using some existing code paste bin.