电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

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

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

瀏覽:2日期: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
相關文章:
主站蜘蛛池模板: 芜湖厨房设备_芜湖商用厨具_芜湖厨具设备-芜湖鑫环厨具有限公司 控显科技 - 工控一体机、工业显示器、工业平板电脑源头厂家 | 讲师宝经纪-专业培训机构师资供应商_培训机构找讲师、培训师、讲师经纪就上讲师宝经纪 | 硅胶制品-硅橡胶制品-东莞硅胶制品厂家-广东帝博科技有限公司 | 碳纤维布-植筋胶-灌缝胶-固特嘉加固材料公司 | 哈尔滨京科脑康神经内科医院-哈尔滨治疗头痛医院-哈尔滨治疗癫痫康复医院 | 全国国际学校排名_国际学校招生入学及学费-学校大全网 | 直齿驱动-新型回转驱动和回转支承解决方案提供商-不二传动 | 蜘蛛车-登高车-高空作业平台-高空作业车-曲臂剪叉式升降机租赁-重庆海克斯公司 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | 杭州荣奥家具有限公司-浙江办公家具,杭州办公家具厂 | 烽火安全网_加密软件、神盾软件官网 | 医院专用门厂家报价-医用病房门尺寸大全-抗菌木门品牌推荐 | 小型高低温循环试验箱-可程式高低温湿热交变试验箱-东莞市拓德环境测试设备有限公司 | 连续密炼机_双转子连续密炼机_连续式密炼机-南京永睿机械制造有限公司 | 美国查特CHART MVE液氮罐_查特杜瓦瓶_制造全球品质液氮罐 | 风化石头制砂机_方解石制砂机_瓷砖石子制砂机_华盛铭厂家 | 噪声治理公司-噪音治理专业隔音降噪公司 | 银川美容培训-美睫美甲培训-彩妆纹绣培训-新娘化妆-学化妆-宁夏倍莱妮职业技能培训学校有限公司 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | 沥青灌缝机_路面灌缝机_道路灌缝机_沥青灌缝机厂家_济宁萨奥机械有限公司 | 无轨电动平车_轨道平车_蓄电池电动平车★尽在新乡百特智能转运设备有限公司 | 桌上式超净工作台-水平送风超净工作台-上海康路仪器设备有限公司 | 查分易-成绩发送平台官网| 压滤机滤板_厢式_隔膜_板框压滤机滤板厂家价格型号材质-大凯环保 | 钢托盘,钢制托盘,立库钢托盘,金属托盘制造商_南京飞天金属制品实业有限公司 | 模具硅橡胶,人体硅胶,移印硅胶浆厂家-宏图硅胶科技 | 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 北京模型公司-工业模型-地产模型-施工模型-北京渝峰时代沙盘模型制作公司 | 聚合氯化铝_喷雾聚氯化铝_聚合氯化铝铁厂家_郑州亿升化工有限公司 | 钢丝绳探伤仪-钢丝绳检测仪-钢丝绳探伤设备-洛阳泰斯特探伤技术有限公司 | 网优资讯-为循环资源、大宗商品、工业服务提供资讯与行情分析的数据服务平台 | 山东锐智科电检测仪器有限公司_超声波测厚仪,涂层测厚仪,里氏硬度计,电火花检漏仪,地下管线探测仪 | 1000帧高速摄像机|工业高速相机厂家|科天健光电技术 | 丝杆升降机-不锈钢丝杆升降机-非标定制丝杆升降机厂家-山东鑫光减速机有限公司 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 流量检测仪-气密性检测装置-密封性试验仪-东莞市奥图自动化科技有限公司 | 消泡剂-水处理消泡剂-涂料消泡剂-切削液消泡剂价格-东莞德丰消泡剂厂家 | 100_150_200_250_300_350_400公斤压力空气压缩机-舰艇航天配套厂家 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 全自动贴标机-套标机-工业热风机-不干胶贴标机-上海厚冉机械 | 无锡网站建设-做网站-建网站-网页设计制作-阿凡达建站公司 |