国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

PHP服務器篇:部署PHP應用到線上Web服務器的方式

瀏覽:3日期:2022-09-16 10:50:37

部署PHP應用到線上Web服務器的方式有很多種。

平臺即服務(PaaS)

PaaS提供運行PHP Web應用所需的系統和網絡環境,對PHP應用和框架只需要做少量的配置即可。

現在PaaS已經成為部署、托管和擴展各種規模的PHP應用的流行方式,可以在?resources部分查看PHP PaaS “平臺即服務”供應商列表。

虛擬或獨立主機

如果你愿意或想學習系統管理,那么虛擬或獨立主機可以讓你完全控制自己的運行環境。

nginx和PHP-FPM

PHP通過內置的FastCGI進程管理器(FPM),可以非常高效地和輕量級的高性能Web服務器nginx進行通信。 nginx比Apache消耗更少的內存,能更好的處理并發請求,這在內存限制較多的虛擬主機環境中尤為重要。

閱讀更多nginx閱讀更多PHP-FPM學習如何配置安全的nginx和PHP-FPMApache和PHP

PHP和Apache是一個老搭檔,歷史悠久。Apache有很強的可配置性和大量的擴展模塊, 是共享主機中常見的Web服務器,完美支持各種PHP框架和開源應用(如WordPress)。可惜的是,默認情況下,Apache比nginx更耗資源,并發處理能力不強。

Apache有多種方式運行PHP,最常見簡單的方式是使用mod_php5的prefork MPM方式, 缺點是它對內存的利用效率不高,如果你不想深入學習服務器的管理,那么這種最簡單的方式就是你的最佳選擇了。注意,如果你使用mod_php5,最好使用 prefork MPM方式。

如果你想追求高性能和高穩定性,那么也可以為Apache選擇與nginx類似的FPM系統worker MPM或?event MPM,它們分別使用mod_fastcgi和mod_fcgid模塊。FPM方式可以更高效的利用內存,運行 速度更快,但是配置也相對復雜一些。

閱讀更多Apache深入學習多進程模塊閱讀更多mod_fastcgi閱讀更多mod_fcgid共享主機

PHP非常流行,很少有服務器沒有安裝PHP的,因而有很多共享主機,不過需要注意服務器上的PHP是否是最新穩定 版本。共享主機允許多個開發者把自己的網站部署在上面,這樣的好處是費用非常便宜,壞處是你不知道將和哪些 網站共享主機,因此需要仔細考慮機器負載和安全問題。如果項目預算允許的話,避免使用共享主機是上策。

Building and Deploying your Application

If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you’re dealing with a simple update, a comprehensive build process or even a continuous integration strategy,?build automation?is your friend.

Among the tasks you might want to automate are:

Dependency managementCompilation, minification of your assetsRunning testsCreation of documentationPackagingDeploymentBuild Automation Tools

Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool is not a part of your software, it acts on your software from ‘outside’.

There are many open source tools available to help you with build automation, some are written in PHP others aren’t. This shouldn’t hold you back from using them, if they’re better suited for the specific job. Here are a few examples:

Phing?is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which is based on?Apache Ant) provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP.

Capistrano?is a system for?intermediate-to-advanced programmers?to execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however people are?successfully deploying PHP systems?with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake.

Dave Gardner’s blog post?PHP Deployment with Capistrano?is a good starting point for PHP developers interested in Capistrano.

Chef?is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn’t just deploy your app but can build your whole server environment or virtual boxes.

Chef resources for PHP developers:

Three part blog series about deploying a LAMP application with Chef, Vagrant, and EC2Chef Cookbook which installs and configures PHP 5.3 and the PEAR package management system

Further reading:

Automate your project with Apache AntMaven, a build framework based on Ant and?how to use it with PHPContinuous Integration

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

– Martin Fowler

There are different ways to implement continuous integration for PHP. Recently?Travis CI?has done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP.

Further reading:

Continuous Integration with JenkinsContinuous Integration with Teamcity
標簽: PHP
相關文章:
主站蜘蛛池模板: 亚洲欧美在线看 | 5x性区m免费毛片视频看看 | 国产成人久久久精品毛片 | 免费看真人a一级毛片 | jk制服福利在线播放 | 亚洲免费视频一区 | 91香蕉视频免费 | 国产一级做a爱免费观看 | 在线播放一区二区精品产 | 真正全免费视频a毛片 | 写真片福利视频在线播放 | 最新黄网 | 欧洲成人全免费视频网站 | 日韩亚洲人成网站在线播放 | 9久久免费国产精品特黄 | 国产一区二区亚洲精品 | 中文日韩字幕一区在线观看 | 九九欧美| 国产精品区一区二区免费 | 99精品国产在现线免费 | 男人的天堂欧美精品色偷偷 | 国产成人精品无缓存在线播放 | 亚洲成a人片在线看 | 国产精品极品美女自在线看免费一区二区 | 亚洲欧美在线免费观看 | 亚洲欧美大片 | 欧美一级爱操视频 | 污美女网站www在线观看 | 97精品国产综合久久久久久欧美 | 亚洲一区二区影视 | 国产精品欧美视频另类专区 | 国产成人在线观看免费网站 | 色综合视频一区二区观看 | 毛片视频网站在线观看 | 99re热在线视频 | 巴西一级毛片 | a国产在线 | 亚洲国产成人最新精品资源 | 高清在线观看自拍视频 | 国产精品久久久久久网站 | 中文字幕日韩在线 |