Windows or unix with php

PHP on linux or windows

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

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

And what myth is this that only the seniors of programming use linux? Do not believe everything they tell you:)

PHP is a multi-platform language, ie just have PHP installed for the chosen system version and it will work.

The 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 a generally advanced way.

Читайте также:  Php системные переменные windows

I’ve never seen this from PHP “abusing Linux”, who told you this was probably wrong.

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 the gringos)

  • Folder Split in Windows uses and in * nix uses / , however if you use only / it will work on both systems
  • * nix has folder permissions for writing, reading, and running Windows not
  • The folder architecture (does not influence much, as usually PHP scripts are in a folder only)
  • * nix is case-sensitive, ie if you have a file named Foo.txt and use the is_file(‘foo.txt’) function, it will return false , however in Windows it is case-insensitive, ie it will return true , so you should only be careful on 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 resolved with other API functions.

Summarizing:

You do not need to buy a computer with Linux just understand the differences of both types of systems (mainly architecture of folders)

Install PHP

Extras

  • PHP can run as a server, however it is not a full server and is only recommended for the development environment, it only works as a server stand-alone , to work as a” full “server you need to download the software separately such as mysql and apache, but there are easier ways, as written above.

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

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

  • C #, F #, Java, Scala, Doo, Nemerle, VisualBasic.NET, Python (there are two PythonNet and IronPython options), JavaScript (IronJS), Oberon, PHP, Pascal Object, Moon, Cobra

Supported but not maintained languages:

I’ll address the topics in parts:

Windows vs. UNIX for application development

There are basically two types of operating systems in mass usage 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 very conflicting usage philosophies.

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

Server operating system

The overwhelming majority of web servers run Linux, as this is the most ubiquitous and most widely supported operating system for running web applications and being completely free and free. Obviously there are many applications running in Windows environments, especially those using Microsoft technologies, such as the .NET platform (C #, ASP.NET, VB.NET) that was specially made to run on that system. In general, the Windows environment may be a bit inhospitable for some types of platforms – try running a Ruby application on Windows without ripping out some hair tufts 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. While there are some efforts by Microsoft to bring its 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 such applications.

If you develop applications for iOS or OS X it is even worse: you are required 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 a lot on personal preference. If you prefer command-line tools, you will usually opt for UNIX, since the command-line environment and the tools available on that system are much than those in Windows (a great example is packages: installing libraries and dependencies on UNIX systems is extremely easy using tools such as Homebrew, APT or Pacman, and in Windows this can become an arduous task, since the tools available are not so 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 so problematic.

There is also a great influence of the community. A good example is Ruby: the overwhelming majority of Ruby developers – let alone all – use UNIX (Linux or OS X) environments. This is due to a number of factors: although it is possible to run Ruby applications in Windows, it is extremely problematic; most Ruby tools use the command line and are inspired by the philosophies of the UNIX environment. Soon it is almost obvious to use Linux or OS X to develop this kind of application.

Just by way of illustration: most of the developers I know use UNIX – some Linux distribution or OS X – but this is a reality of the type of application I develop and the community in which I am included.

Dual-boot

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

Источник

HowTo: Browser and OS Detection with PHP

JournalXtra

A very quick PHP script for detecting browser/device and OS agent strings from the HTTP User Agent variable. This is not 100% reliable because surfers and bots sometimes hide or falsify the user agent string so please use with caution.

Browser and OS Detection Script

This script detects whether the OS/Device is Linux, MacOS, iPad, iPhone, Droid, Unix, Windows or anything else (caught in Unknown). It also detects whether the browser is Chrome, Firefox, Opera or Internet Explorer.

  • The user agent string is stored in the variable $agent.
  • The operating system or device is stored in the variable $os.
  • The browser is stored in $br.

Copy and paste the following code into the top of your PHP file or save it in its own PHP file and use a PHP include to bring it into the file where the $br and $os variables are used:

Use the Script

The detection script checks a web browser’s user agent string for specific words like Chrome, Unix, Windows and Firefox. Here is a basic run though of how to use those user agent strings:

// Action when OS/Device is found if($os==’Linux’) < echo 'This is done when the OS/Device is Linux'; >if($os==’Mac’) < echo 'This is done when the OS/Device is MacOS'; >if($os==’iPhone’) < echo 'This is done when the OS/Device is iPhone'; >if($os==’iPad’) < echo 'This is done when the OS/Device is iPad'; >if($os==’Droid’) < echo 'This is done when the OS/Device is Droid'; >if($os==’Unix’) < echo 'This is done when the OS/Device is Unix'; >if($os==’Unknown’) < echo 'This is done when the OS/Device is unknown. This is the failsafe for when an OS/Device is not detected.'; >// Action when Browser is detected if($br==’Firefox’) < echo 'This is done when the Browser is Firefox'; >if($br==’Chrome’) < echo 'This is done when the Browser is Chrome'; >if($br==’Opera’) < echo 'This is done when the Browser is Opera'; >if($br==’MSIE’) < echo 'This is done when the Browser is Microsoft Internet Explorer'; >if($br==’Unknown’) < echo 'This is done when the Browser is Unknown. This is the failsafe for when a browser type is not detected'; >// Action when both browser and OS/Device are detected if($os==’Linux’ && $br==’Firefox’) < echo 'This is done when the Browser is Firefox and the OS is Linux.'; >if($os==’Unknown’ && $br==’Unknown’)

It’s a simple script and very easy to use. If you need help, use the message box below to tell me.

Original content here is published under these license terms: X
License Type: Read Only
License Abstract: You may read the original content in the context in which it is published (at this web address). No other copying or use is permitted without written agreement from the author.

Источник

Brande

i using php upload file server , pass path sql stored procedure bulk insert import file sql table.

in sql know how bulk insert work both windows , unix based csv , txt files need know format is.

i hoping figure out in php , pass stored procedure. can update rowterminator accordingly.

is there way in php detect if csv or txt windows or unix based?

get first line file. check if last 2 chars or last char are:

$lines = file('test.csv'); $line = $lines[0]; switch(true) < case substr($line, -2) === "\r\n" : echo "windows"; break; case substr($line, -1) === "\n" : echo "unix"; break; default : // pigs can fly echo "unknown line ending" break; >
  • Get link
  • Facebook
  • Twitter
  • Pinterest
  • Email
  • Other Apps

Comments

Post a Comment

linux — Does gcc have any options to add version info in ELF binary file? —

i mean whether gcc can insert source code version infor elf binary section or similar. not want change source file, add info gcc option in makefile. you can emit version info text file, turn text file object file statically link executable. the first step simple have write code: script or write version info in format plain text file. write makefile rule produce version.o version.txt, using objcopy . you’ll have object file 2 useful symbols defined in it: beginning , end of textual version info. add generated object executable, , you’ll able access version 2 ways: running strings on binary, or writing code in application print version string (you’ll need declare start , end symbols variables in header file).

android — send complex objects as post php java —

is possible send contact numbers via post php class inside eclipse ? or post limited primitive types , have find work arounds send them string ? i propose: send them json in post request, befor start, have @ gson project , keep in mind set content application -> json. luck

Источник

Оцените статью