search
HomeBackend DevelopmentPHP Tutorial问问大家都怎么结合Linux开发的

项目是部署在Linux服务器上面的,开发过程也提倡使用Linux环境来运行程序进行测试,别到最后上线发现问题追踪起来才知道是在Windows下测试没考虑到Linux的问题,当然这种可能比较少,我遇到过的经典问题就是文件名大小写没注意导致部署到Linux后说找不到文件,还有就是文件目录读写权限未设置导致一些上传功能不能运作等,那是好久好久以前的事了,现在都在Linux下运行程序,所以都能发现注意

我想了解下大家部署在Linux上的项目,自己开发过程中是怎么一个方式去做呢?
1.首先我了解到一些人是自己的工作机上用wamp之类的在windows上搭建apache/nginx环境来跑自己的测试程序,确定功能开发完成后提交到公司的Linux测试机作进一步测试,最后部署上线

2.如果说在自己的工作机上开发时就得用国linux环境测试,那要么在windows下敲代码,敲完后把文件传到linux虚拟机,建一个host指向linux,就这样访问这个host测试,我正是用这种方式,不知道是不是大部分phper都用了这种方式,还是依然在windows下运行


我纠结的第一个问题是:个人开发过程在linux下跑程序测试的必要性有多大?因为跑linux虚拟机又要耗点内存,机器更卡了一点,黑心老板最坑爹的情况下只给你1GB物理内存咋办,虽然我们公司标配4G内存,我是8G,但我也同情2G的同事这样耗着跑程序.在linux下跑个人测试的好处是否远远大于降低机器运行速度的代价呢?貌似不行,某些同事还是偷偷跑回windows下做个人测试了

第二个问题,如果大部分phper都在linux下跑个人开发这一环节,是在windows下写好文件传过去,还是在linux下敲代码?在windows下写的话,一个功能下来牵连到五六个文件,每在一个文件写完后都操作一次文件上传?而如果在linux下写代码,我虽然意识到熟用各种vim命令的情况下确实敲代码非快,但有时候貌似也不那么方便,我在维护一个类,想快速定位到我想要的那个方法,但是不太记得拼写了,这时候除了能通过字符搜索来找到那个方法名,却不能像IDE那样有一个Class的方法列表直接双击跳转到那一行定焦啊,所以只在linux下用vim我暂时做不到,不知道大家是不是真的这样,也听说过有人这样,貌似为数不多

我当然是在windows下开发再传到linux运行的,在这里又想了解一下大家是怎么解决这个文件传递问题,其实方法是很多的,古老的samba,ftp/sftp,ssh,而我则是用mount的,我尝试过改一下就操作一次FTP传递指定文件,切换窗口太频繁又麻烦.
于是现在是共享windows下的D:/dev/project目录并命名为project
创建一个windows用户test,密码test
在linux里mkdir /var/www/project
mount -t cifs -o user=test,pass=test,rw,uid=linux用户的uid,gid=linux群组的gid //192.168.1.物理机/project /var/www/project
当然/etc/rc.local也写了这个挂载命令
这样就实现了在windows下修改文件,linux马上同步过去,不知道大家也是不是这样玩,还是真的用ftp一次次拖文件,缺点是要求物理机稍加一点硬件性能吧,不过其实就算这样做了也未必容易发现读写权限造成的问题,就是贴近了线上环境更加安心开发了


回复讨论(解决方案)

围观 学习

直接在windows开发啊,你知道的windows出现的一些问题 避免就好了,windows开发直接svn,测试环境可以部署到linux上,直接svn up就可以用了。

在Linux下直接写文件.如果服务器是Linux 客户端是Win 那么就用FTP.

window开发,通过svn,git 提交到服务器即可,在window下开发的时候,需要注意window和linux下的大小写,权限等一系列的问题,如果是租用的服务器或者vps,则可以通过ftp上传window下文件到服务器。

这样看上去以上回复的朋友们都是在Windows下敲代码然后直接在Windows下运行
测试好后就通过FTP或svn的方式交到服务端运行是吗?

由于线上服务器的程序不允许随意修改,所以这一点上不可能让随便一个开发人员提交SVN就将文件传到远程服务器导致线上发生变化,任何开发人员开发完东西都只能提交SVN勾文件到内网统一测试服务器,测试完后由技术经理审核确认无误再单独打包到线上,所以我们不是这样玩的

但这个关系并不大,我在乎的是有多少人是将自己敲好的代码直接放Linux下运行的,如果你是这样运行的话,你真的是用vim吗?用vim在代码导航问题上又怎么解决呢,好像Windows的IDE操作更方便快捷的样子哦,再者vim又不能重构变量

Linux下也有可用的IDE开发工具并且比在Win下运行得还要畅顺. 这个具体部署方式的话就要看你们的工作环境来说了,不是千篇一律的. 在服务器 VIM 是有时候迫不得已而已...谁想用那个VIM来敲代码...

Linux下也有可用的IDE开发工具并且比在Win下运行得还要畅顺. 这个具体部署方式的话就要看你们的工作环境来说了,不是千篇一律的. 在服务器 VIM 是有时候迫不得已而已...谁想用那个VIM来敲代码...
我知道linux下有桌面环境并且有Eclipse等东西,,确实没试过这一方面,日后接触一下看看

VIM方面从古时候就听说编辑速度根本就可以超越Windows下的编辑器,主要是能熟用各种命令和快捷键吧,要求相对高,要练到滚瓜烂熟才行,总体上来说我比较认同的,但最近发现要像IDE那样查看一个方法列表并且跳转到指定的方法体内就没办法.一个好久不动的类突然要去维护那个方法在第几行都不知道,非得在windows下看看行数再回去改,所以开始质疑VIM的速度真的比windows下的编辑器或IDE快么,或者仅仅也只是这些某一小部分不够方便而已?

如今有多少phper在linux下玩VIM呢?

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.