PHP on linux or windows

Asked

Viewed 2,210 times

7

Explanation:

I know it’s a controversial question, but I’m not an old man of programming and I have knowledge of linux, but I never chose it because I use C# from time to time and in my college they are pro-microsoft. So the work is mostly on Windows and I think that Dual-boot does not do well for my PC that doesn’t look like it was made for this.

Question:

My effective programming language is PHP and I see frameworks that abuse Linux more than Windows itself, I must then surrender and buy a linux notebook or there are senior professionals who like Windows to mess with Linux?

  • 3

    a comment nothing to do but , change college.. I have nothing against MS, on the contrary, MS use as a primary tool, but at college level, you should be in a more open environment where you are not "stuck" to a brand or product. The faculty where you are will only form people "technologically engineered"...

2 answers

11


And what is this myth that only the elderly use linux? Don’t believe everything they tell you :)

PHP is a cross-platform language, that is to say just have PHP installed for the version of the system chosen and it will work.

PHP Apis are all compatible with any operating system (having rare functions that do not work on Solaris (another operating system) and few functions with vague differences between systems, if used in advanced mode generally.

I never saw this from PHP "abusing linux", who told you this was probably mistaken.

The only thing that will change from Windows to Linux/Unix to PHP:

Note that to refer to systems similar to linux or Unix we can use the term *nix or the term like-unix (much used by gringos)

  • Folder splitting in Windows uses \ and in *Nix uses /, however if using only / will work on both systems
  • *Nix has folder permissions for writing, reading and running Windows not
  • Folder architecture (does not influence much, because usually PHP scripts are in one folder)
  • *Nix usually is case-sensitive, ie if you have a file with the name like this Foo.txt and use the function is_file('foo.txt'), will return false, however Windows is case-insensitive, ie will return true, then you should only be careful in windows, as this can cause problems if the production server is *Nix.

So the choice of environment makes little difference to PHP and the rare incompatibilities are usually solved with other API functions.

In short:

No need to buy a Linux computer just understand the differences of both types of systems (folder architecture mainly)

Install PHP

Extras

  • PHP can run as a server, but it is not a complete server and is only recommended for the development environment, it only works as a server stand-alone, to function as a "complete" server it is necessary to download the software separately as mysql and apache, but there are easier ways, as written above.

  • The Wamp meaning would be Windows Apache, Mysql and PHP, just as Xampp means Apache, Mysql, Php and Perl (the X indicates multi-platform) and Lamp would be Linux, apache, mysql and PHP.

  • In addition to Apache there are other alternative servers like Nginx and the Lighttpd

  • Linux is not an operating system, it is the kernel or is a Linux system is actually a Linux based system only, I believe that all Linux distros today run with linux-3.* or linux-4.

  • Unix is also not a system, but rather a kernel, which is used by many systems (modified of course), such as Macosx and the BSD family.

  • Linux and Unix although they use a similar folder structure and have similar "high-level" responses, they are not an evolution of each other and neither are "cousins", they are distinct nuclei, so much so that GNU (the formal name of Linux would be GNU/Linux) would mean something like GNU is Not UNix (English: GNU Not Unix)

  • Their equivalent in Windows would be the core Windows NT.

    Read more on: Kernel_(operating_system)en

  • The C# can run in *Nix environments, using Mono, in addition to C# there are other supported languages and as amazing as it may seem some of the projects that maintain support for these languages can support "Windows" as well.

    Supported languages (languages in Mono):

    • C#, F#, Java, Scala, Doo, Nemerle, Visualbasic.NET, Python (there are two options Pythonnet and Ironpython), Javascript (Ironjs), Oberon, PHP, Object Pascal, Lua, Cobra

    Other languages:

    • Component Pascal, Delta Forth, Dotlisp, #Smalltalk

    Supported but not maintained languages:

    • C, Ruby and Ada
  • C# can also run in linux and macOS environments using .NET Core, being this microsoft official (released in June 2016), more details on: https://docs.microsoft.com/pt-br/dotnet/core/about

4

I will address the topics by parts:

Windows vs UNIX for application development

There are basically two types of operating systems in mass use in the world today: Windows w UNIX (Linux distributions, Apple OS X, BSD). So’s of these two types are extremely different, solve problems in completely different ways and have quite conflicting usage philosophies.

I will not go into detail about these differences here because I think it does not fit in this topic, but it is very useful to keep in mind that there is no way to directly compare the two and choose a better one: they are different pets, each with its qualities and defects; point out that one is better than the other without taking into account the context where they are being used would be stupid.

Operating system for server

The overwhelming majority of web servers run Linux, because it is the most ubiquitous operating system with the most support for running web applications and for being completely free and free of charge. Obviously there are many applications running in Windows environments, especially those that use Microsoft technologies, such as the platform. NET (C#, ASP.NET, VB.NET) which was specially made to run on this system. In general the Windows environment can be a little inhospitable for some types of platforms - try running a Ruby application on Windows without pulling out a few tufts of hair trying to debug the torrent of problems that occur :)

Operating system for development machine

If you develop applications using Microsoft technologies (.NET for example) there is not much choice: the solution is to use Windows. Although there are some efforts by Microsoft to bring their platform to other operating systems (such as Visual Studio Code, released this week by Microsoft), only Windows offers all the support you need to develop these kind of applications.

Whether you develop apps for iOS or OS X is even worse: you’re forced to use a Mac.

Now, for development in other more open technologies there are more options. PHP is a good example: you can develop web applications using PHP on both Windows and UNIX systems. Which one you will choose depends very much on personal preference. If you prefer command-line tools, you will usually opt for UNIX, since the command-line environment and tools available on that system are much superior to those present in Windows (a great example are package managers: installing libraries and dependencies on UNIX systems is extremely easy using tools like Homebrew, APT or Pacman; whereas in Windows this can become an arduous task, given that the tools available are not as advanced and use a very different philosophy). If you prefer to use IDE’s and other visual tools there is greater flexibility, and using Windows does not become as problematic.

There is also a great influence of the community. A good example is Ruby: the overwhelming majority of Ruby developers - not to mention everyone - use UNIX (Linux or OS X) environments. This happens by a number of factors: although possible it is extremely problematic to run Ruby applications on Windows; most Ruby tools use the command line and are inspired by the philosophies of the UNIX environment. So it’s almost obvious to use Linux or OS X to develop this kind of application.

Just by way of illustration: most developers I know use UNIX - some Linux distribution or OS X - but this is a reality of the kind of application I develop and the community I’m in.

Dual-boot

You can do dual-boot on any computer, no need for a specific computer to run Linux. Modern distributions have great support for various types of hardware and we have more progress on this issue each time, so you should have no problem running a Linux distribution on current hardware.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.