简体   繁体   English

将PHP部署到Heroku

[英]Deploy PHP to Heroku

Since Heroku began Facebook integration awhile ago, I've wanted to deploy a few PHP files without having to use Facebook and just viewing my PHP on Heroku. 由于Heroku刚开始Facebook集成,我想部署一些PHP文件,而不必使用Facebook,只需在Heroku上查看我的PHP。 This link here, Deploying Wordpress to Heroku simply states you can. 这里的链接,将Wordpress部署到Heroku只是说明你可以。 But, I can't seem to figure out the PHP portion. 但是,我似乎无法弄清楚PHP部分。 I have a Rack app already built and tried some implementation that would just view PHP instead of HTML, and that didn't work. 我已经构建了一个Rack应用程序并尝试了一些只能查看PHP而不是HTML的实现,但这样做不起作用。 All it did is display static text. 它只是显示静态文本。 The same with just having a PHP file on the app in the /public folder, just displays static text. 只需在/ public文件夹中的应用程序上有一个PHP文件,就可以显示静态文本。 This has to work somehow since the link I shared works you through the process of getting Wordpress on Heroku. 这必须以某种方式工作,因为我分享的链接使您通过在Heroku上获取Wordpress的过程。 If anyone could, tell me how to get a few PHP files running on my Heroku app, I'd really appreciate it. 如果有人可以,告诉我如何在我的Heroku应用程序上运行一些PHP文件,我真的很感激。

Thanks 谢谢

You need to create your Heroku app on the new Cedar stack. 您需要在新的Cedar堆栈上创建Heroku应用程序。 Cedar stack apps reside on the domain herokuapp.com rather than heroku.com, so you'll know if you've got the right one. 雪松堆栈应用程序驻留在域名herokuapp.com而不是heroku.com上,因此您将知道您是否拥有正确的应用程序。 Then it's really as simple as pushing your PHP files. 然后它就像推送PHP文件一样简单。 To create an app on the Cedar stack, use: 要在Cedar堆栈上创建应用程序,请使用:

heroku create

Or, if you'd like to set a name, (ie myname.herokuapp.com) use: 或者,如果您想设置名称,(即myname.herokuapp.com)使用:

heroku create myapp

For the benefit of others who are not as au fait with Git, you will also need to set up, commit and push your Git repository: 为了使其他人不受Git的影响,您还需要设置,提交和推送您的Git存储库:

git init
git add .
git commit -m 'Initial commit'
git push heroku master

That's it! 而已! Good luck and have fun. 祝好运并玩得开心点。

你不需要做任何事情 - 只需推动你的PHP代码并发生Heroku魔术 - 我不是PHP大师,但最近不得不部署一个PHP站点,我只是将代码推送到一个新的Cedar应用程序,没有更改目录结构等,它的工作原理。

Heroku现在有一个部署PHP的指南,Heroku上的PHP 入门 ,这解释了Heroku依赖于Composer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM