在Linux平臺下使用PHP開發(fā)網(wǎng)站
Jun 06, 2016 pm 08:35 PM
本人php程序員,工作經(jīng)驗(yàn)即將滿一年,現(xiàn)在有跳槽的想法,在拉勾上看了很多中大型公司對php程序員的要求都會(huì)提到一點(diǎn)“在Linux平臺下使用PHP開發(fā)網(wǎng)站”。
本人對這句話不是特別理解,怎樣才算在Linux平臺下使用PHP開發(fā)網(wǎng)站?
在win下開發(fā),然后linux下運(yùn)行?
在linux下開發(fā),之后在linux下運(yùn)行?
linux下怎樣開發(fā)呢?本人對于linux,目前只是知道一些簡單指令操作。
希望在這里能有大神、有經(jīng)驗(yàn)者、大牛為本人解答一下。
無以為報(bào),只能先說感謝——————一個(gè)努力的phper!
回復(fù)內(nèi)容:
本人php程序員,工作經(jīng)驗(yàn)即將滿一年,現(xiàn)在有跳槽的想法,在拉勾上看了很多中大型公司對php程序員的要求都會(huì)提到一點(diǎn)“在Linux平臺下使用PHP開發(fā)網(wǎng)站”。
本人對這句話不是特別理解,怎樣才算在Linux平臺下使用PHP開發(fā)網(wǎng)站?
在win下開發(fā),然后linux下運(yùn)行?
在linux下開發(fā),之后在linux下運(yùn)行?
linux下怎樣開發(fā)呢?本人對于linux,目前只是知道一些簡單指令操作。
希望在這里能有大神、有經(jīng)驗(yàn)者、大牛為本人解答一下。
無以為報(bào),只能先說感謝——————一個(gè)努力的phper!
這句話具體什么含義確實(shí)很難搞清楚,這些職位要求都是大家互相抄,很多 HR 對技術(shù)一知半解,照樣寫職位要求。
不管怎么說,只要你熟練使用 Linux,又有何懼呢?
另外:關(guān)于 Linux,我認(rèn)為開發(fā)者不是運(yùn)維,重點(diǎn)在開發(fā),所以在成為大牛前 Linux 要多牛逼也不是必須的,因?yàn)楦嗟腜HPer 寫的是業(yè)務(wù),不是內(nèi)核。當(dāng)然,這并不是你不搞 Linux 的借口。Linux 的基礎(chǔ)知識 、常用命令還是要的。建議堅(jiān)持使用一年的 Linux 桌面(可以考慮 Ubuntu
或 Fedora
這兩個(gè)發(fā)行版),多用 Shell 處理問題(我曾經(jīng)就是這么干的。),Linux 自然就熟了。我看到很多人說 Linux 下沒有好的 PHP IDE,我就郁悶了,難道他們用的都不是 PHPStorm
?
開發(fā)是一回事,部署是另外一回事,在win上開發(fā)的代碼部署到linux上環(huán)境上不一定能正常運(yùn)行,特別涉及到文件權(quán)限的問題。所以一般開發(fā)php的都要求掌握linux相關(guān)的知識,因?yàn)榇蟛糠謕hp都會(huì)部署在linxu server上。
額,說得好像linux下沒有php的IDE一樣。。。還有l(wèi)inux開發(fā)網(wǎng)站怎么就不方便了,除了要兼容調(diào)試IE
回答這個(gè)問題的各位同仁,你們真的是在linux開發(fā)和部署項(xiàng)目的嗎?你們真的是了解了“在Linux下開發(fā)”的真實(shí)需求嗎?
舉個(gè)栗子:求PHP高效遍歷文件夾的方法
http://www.oschina.net/question/260395_162648
在Linux上開發(fā),要求你了解Linux下最常見的文件操作、網(wǎng)絡(luò)操作、異常處理、shell、任務(wù)、定時(shí)、權(quán)限。
不管你是在Windows下開發(fā),還是Linux下開發(fā),只要項(xiàng)目能在Linux上運(yùn)行,我覺得都可以稱為是俠義的Linux上開發(fā)。但如果連Linux最核心的大招都不會(huì)使用(如awk、sed、shell、lvs、Hdfs、計(jì)劃任務(wù)、多進(jìn)程),即使是在Linux上開發(fā)和部署的,用的還是從Windows上學(xué)來的冗長、低效的代碼,那我覺得也不叫“Linux上開發(fā)”。
我覺得“Linux上開發(fā)”可以理解為,可以掌握Linux上開發(fā)的常見問題及解決辦法、性能優(yōu)化方法、集群搭建方法,掌握Linux下文件(協(xié)議)操作、網(wǎng)絡(luò)(協(xié)議)操作、集群搭建方法,能用Linux命令、擴(kuò)展,能穩(wěn)定、快速的解決項(xiàng)目的業(yè)務(wù),能使用Linux實(shí)現(xiàn)較低成本獲取較高的性價(jià)比的開發(fā)。
高手,善于運(yùn)用工具,而Linux,就是最終極的武器。你用過了嗎,會(huì)用嗎?
這句話翻譯過來是這樣的:
“熟練使用Linux操作系統(tǒng)完成php開發(fā)任務(wù)”
開發(fā)和運(yùn)行是分不開的,我個(gè)人的習(xí)慣是改一點(diǎn),打開網(wǎng)頁測試一下。所以關(guān)于這個(gè)問題我個(gè)人的理解就是在Linux下配置整套開發(fā)和運(yùn)行環(huán)境,可以直接在Linux下寫php代碼,通過訪問localhost來測試網(wǎng)站。
你不可能每次寫完之后都部署到服務(wù)器上去運(yùn)行吧。php打開個(gè)文本編輯器就能寫,而且apache和mysql在linux底下也有,在哪里不能開發(fā)呢?lamp里面那個(gè)l就是linux。
或者可以理解為vim你熟練掌握了沒?
我曾經(jīng)也有這樣的疑問,但是linux開發(fā)網(wǎng)站會(huì)非常不方便,除非是mac 電腦。
純手寫的代碼可以比得過IDE?
在widows下使用IDE開發(fā)PHP網(wǎng)站,在linux托管運(yùn)行,我就一直是這么干的。
如果要求高一點(diǎn)的話,這句話可以理解為:會(huì)在linux下搭建lamp/lnmp,熟練使用常用命令,會(huì)查錯(cuò)誤日志,針對一些報(bào)錯(cuò)能找到解決方案,熟練運(yùn)用vim。
個(gè)人覺得,首先要熟練Linux下php環(huán)境的配置,php開發(fā)工具、測試工具的使用。
然后熟悉nginx配置,nginx如何運(yùn)行php的,與apache的比較(apache以php_module方式運(yùn)行,nginx以fastcgi方式運(yùn)行)。
另外要懂一些運(yùn)維知識,懂一些運(yùn)維知識對開發(fā)是有好處的,就像運(yùn)維人員需要懂點(diǎn)開發(fā)一樣。
熟練linux下php性能監(jiān)控,壓測。監(jiān)控CPU使用率,分析php-fpm輸出日志,跟蹤進(jìn)程等,這些使用linux命令就可以完成。
個(gè)人見解,希望對你有幫助。
其實(shí)在你只要服務(wù)器環(huán)境是linux就行了,開發(fā)在windows也無所謂,像我就是用vbox里面裝ubuntu來配置LNMP環(huán)境,在windows下做開發(fā)。不過想要學(xué)好linux最好還是裝在自己桌面上,推薦ubuntu,cent也行
有什么大的區(qū)別么……配置文件基本一樣……
桌面發(fā)行版開發(fā)和windows沒什么大區(qū)別,IDE都跨平臺的……
部署的時(shí)候只能SSH連終端而不是windows的遠(yuǎn)程桌面這是唯一覺得不爽的。
習(xí)慣就好。
linux
下開發(fā)好處不是很多,比如能避免文件名大小寫
、路徑反斜杠
、讀寫權(quán)限
等問題,在windows
開發(fā)你只有部署上去了才能發(fā)現(xiàn)!
很簡單的,給自己的windows系統(tǒng)裝個(gè)虛擬機(jī),虛擬機(jī)里是centos或?yàn)醢鄨D,然后在虛擬機(jī)里裝php和mysql,部署并測試程序,多試試即可。
樓主可以搜一下LAMP
...
我感覺 就是 讓你會(huì) lnmp 配置 和一些 linux web 運(yùn)維的知識 基本上就夠了 當(dāng)然 也有喜歡在linux開發(fā)的 這得看個(gè)人愛好 我個(gè)人感覺 win 和 linux 各有各的好處
千萬別在Win下開發(fā)PHP 絕對的坑~win下寫的PHP代碼在linux下各種異常難調(diào)試,
虛擬機(jī)也別用,用了虛擬機(jī)自己心里還是有退路的(分手就應(yīng)該要痛快)
用半年ubuntu,上手了果斷centOS,2年內(nèi)爭取archlinux,筆記本的話就mac,mac下開發(fā)的php 在linux下運(yùn)行都是99%兼容的
不就是想告訴應(yīng)聘者要自己會(huì)搭LAMP或LNMP嘛,這有啥,Centos配配超簡單,Linux下寫PHP不是也有sublime text嘛,上傳用Filezilla,Linux一樣搞,這都不是事兒

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHPhasthreecommentstyles://,#forsingle-lineand/.../formulti-line.Usecommentstoexplainwhycodeexists,notwhatitdoes.MarkTODO/FIXMEitemsanddisablecodetemporarilyduringdebugging.Avoidover-commentingsimplelogic.Writeconcise,grammaticallycorrectcommentsandu

The key steps to install PHP on Windows include: 1. Download the appropriate PHP version and decompress it. It is recommended to use ThreadSafe version with Apache or NonThreadSafe version with Nginx; 2. Configure the php.ini file and rename php.ini-development or php.ini-production to php.ini; 3. Add the PHP path to the system environment variable Path for command line use; 4. Test whether PHP is installed successfully, execute php-v through the command line and run the built-in server to test the parsing capabilities; 5. If you use Apache, you need to configure P in httpd.conf

The basic syntax of PHP includes four key points: 1. The PHP tag must be ended, and the use of complete tags is recommended; 2. Echo and print are commonly used for output content, among which echo supports multiple parameters and is more efficient; 3. The annotation methods include //, # and //, to improve code readability; 4. Each statement must end with a semicolon, and spaces and line breaks do not affect execution but affect readability. Mastering these basic rules can help write clear and stable PHP code.

The steps to install PHP8 on Ubuntu are: 1. Update the software package list; 2. Install PHP8 and basic components; 3. Check the version to confirm that the installation is successful; 4. Install additional modules as needed. Windows users can download and decompress the ZIP package, then modify the configuration file, enable extensions, and add the path to environment variables. macOS users recommend using Homebrew to install, and perform steps such as adding tap, installing PHP8, setting the default version and verifying the version. Although the installation methods are different under different systems, the process is clear, so you can choose the right method according to the purpose.

PHPisaserver-sidescriptinglanguageusedforwebdevelopment,especiallyfordynamicwebsitesandCMSplatformslikeWordPress.Itrunsontheserver,processesdata,interactswithdatabases,andsendsHTMLtobrowsers.Commonusesincludeuserauthentication,e-commerceplatforms,for

The key to writing Python's ifelse statements is to understand the logical structure and details. 1. The infrastructure is to execute a piece of code if conditions are established, otherwise the else part is executed, else is optional; 2. Multi-condition judgment is implemented with elif, and it is executed sequentially and stopped once it is met; 3. Nested if is used for further subdivision judgment, it is recommended not to exceed two layers; 4. A ternary expression can be used to replace simple ifelse in a simple scenario. Only by paying attention to indentation, conditional order and logical integrity can we write clear and stable judgment codes.

How to start writing your first PHP script? First, set up the local development environment, install XAMPP/MAMP/LAMP, and use a text editor to understand the server's running principle. Secondly, create a file called hello.php, enter the basic code and run the test. Third, learn to use PHP and HTML to achieve dynamic content output. Finally, pay attention to common errors such as missing semicolons, citation issues, and file extension errors, and enable error reports for debugging.

TohandlefileoperationsinPHP,useappropriatefunctionsandmodes.1.Toreadafile,usefile_get_contents()forsmallfilesorfgets()inaloopforline-by-lineprocessing.2.Towritetoafile,usefile_put_contents()forsimplewritesorappendingwiththeFILE_APPENDflag,orfwrite()w
