Home > Article > Backend Development > Should I use win or linux system for php?
php can use win or linux system. They each have their own advantages, such as: 1. Windows server is easy to operate and suitable for php beginners; 2. Linux server is suitable for php mature people and can better build LAMP. environment etc.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
Should I use win or linux system for php?
Both windows and Linux are available, each has its own advantages.
1. The windows server is easy to operate and suitable for PHP beginners. With the popularity of Windows Server2008 server, Microsoft has developed PHP Manager, a control suitable for PHP. You can use IIS7.5 PHP Manager PHP5.3 Mysql5. 5. Easily build a PHP environment, and the window is the operating interface for beginners to maintain and learn.
2. Linux server is suitable for mature PHP users. With the popularity of Linux desktop tools, it is no longer simple coding, but also has its own operating desktop. The purpose of using Linux server is to better build a LAMP environment. , and Linux is open source and free, making it easier for code-level development to optimize services and layout suitable security solutions. In addition, the core of Linux has stability and higher education that Windows cannot match, and has powerful network service functions that can be implemented Various network services, such as email services, Web services, FTP, DNS, DHCP, firewalls, proxy servers, routers, etc.
PHP determines whether the server is a Windows system or a Linux system:
Simply determine whether the server operating system is Windows or Linux. The relevant functions or predefined variables are:
php_uname(); PHP_OS DIRECTORY_SEPARATOR PHP_SHLIB_SUFFIX PATH_SEPARATOR
php determines whether Windows or Linux System method one:
<? if(PATH_SEPARATOR==':'){ echo 'Linux系统'; }else{ echo 'Windows系统'; } ?>
About PATH_SEPARATOR Introduction: Use include multiple paths. Under win, when you want to include multiple paths, you have to use ";" to separate them, but under Linux, use " : "Separated. The use of these two constants can avoid compatibility issues on different platforms.
php Method 2 to determine whether Windows or Linux system:
<?php if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { echo '这个服务器操作系统为Windows!'; }else{ echo '这个服务器操作系统不是Windows系统!'; } ?>
Recommended study: "PHP Video Tutorial"
The above is the detailed content of Should I use win or linux system for php?. For more information, please follow other related articles on the PHP Chinese website!