Java and many other strongly typed programming languages give you the possibility to distinguish between "byte[]" and "string", where the type "string" usually "abstracts away" logic (e.g. for Unicode), which gets executed behind the scenes.
Now, since PHP has only "string" (so far (we are getting more and more typing, yay!)), it behaves as byte[] - e.g. hex2bin() or encryption related functions return or deal with raw byte[] data... A.k.a "string" in PHP for historical reasons. Changing the type "string" would break this. So, the quickest way to deal with Unicode strings without breaking stuff was to add mbstring. The other (more complete solution) would be to introduce strong typing, which would enable types like byte[].. we are not there yet
I understand what OP is saying is that there is a piece of bad code in the world that happens to be popular at the same time. And OP hopes that future PHP versions will not be compatible with that code, so that it will stop working and finally become history. OPs frustration is with the bad implementation of that particular project, because it reflects badly on PHP.
And/or maybe the server is trying to load a file, for which the server has not the correct permissions to read. E.g. the server runs as user www-data and the file is only accessible for some other user. (..too keep the example simple)
In the company, where I work, we use PHP as the glue between backend services (which are written in PHP or another lang - whatever fits the best) and the Frontend. IMO it's this place where PHP is a good fit.
It's hard to tell with that little information provided.
We don't know how big the codebase is, what dependencies it has, if composer is used or not and if a test suite exists. Do you even use git, can you upgrade to PHP 8.1 without upgrading your OS?.. It's even hard to tell with all that info tbh.. because in reality you can only estimate time for a given plan. Your question is the typical part time manager type of question: "how long will the thing take that we don't know how to do yet?".
If experience exist for a task, plans can be plotted quickly based on experience and then time can be estimated. If no experience exists for a particular task yet, I would say do calculate with 2 days for investigation what possibilities exist (you are in this phase right now, I guess - take a look at "rector").
My suggestion would be to install a fork of the project (or the part of it, that needs to be upgraded) on a test environment. <- one point you can estimate how long this would take you
Then try rector to do the upgrade. You could be lucky and rector will convert the code in few seconds. I hope you have a test suite..
Already did (actually I have some codebases still doing it partially).
Fun fact: It actually works better with WSL1 because in WSL1 there is no native linux kernel involved and Windows could do native FS calls to the WSL1 side and the other way around. In WSL2 the original Linux kernel is used, which has lots of advantages - but the interoperation of FS suffered a lot because native Filesystem calls are not possible anymore - so, for example if the IDE/Editor is running on Windows and is monitoring filesystem events, using the OS native API for file-watching, it is no wonder that it will come to weird results when its watching "linux files"on a netshare with the Windows-native filewatcher :) However, the Jetbrains IDEs has a own Filewatcher API, maybe Jetbrains implements a own filewatcher that works better in this case - I am using SublimeText.
I dont do it that way because of the poor performance. It's ok for little things but for large codebases it simply is not fast enough and also has some quirks sometimes.
WSL2 is the way to go. But you should make sure not to host the codebase on a windows partition that the WSL2 instance reads and writes because this is super slow.
What I do is, I have a git repo on my windows where I do modifications to the code and a 'bare repo' on the Linux side, that serves as a 'git remote' where I push my commits to. On the Linux side I pull it. It sounds more cumbersome that it actually is and with some helper scripts it just works fine.
About the "Apache" part: in the end you will stick to the companies choice but I have the feeling that the world moved to NGINX.
a company that wants to pay their tech dept.. good one
shaving the face
i can already see how people will shoot legs, own and others
exceptions are a good use case for inheritance: https://www.php.net/manual/en/language.exceptions.extending.php
functions are better
the title says it all
you should have a good reason not to use prepared statements, not the other way around
is it still good?
Java and many other strongly typed programming languages give you the possibility to distinguish between "byte[]" and "string", where the type "string" usually "abstracts away" logic (e.g. for Unicode), which gets executed behind the scenes.
Now, since PHP has only "string" (so far (we are getting more and more typing, yay!)), it behaves as byte[] - e.g. hex2bin() or encryption related functions return or deal with raw byte[] data... A.k.a "string" in PHP for historical reasons. Changing the type "string" would break this. So, the quickest way to deal with Unicode strings without breaking stuff was to add mbstring. The other (more complete solution) would be to introduce strong typing, which would enable types like byte[].. we are not there yet
Well, it must begin with a "P"
I understand what OP is saying is that there is a piece of bad code in the world that happens to be popular at the same time. And OP hopes that future PHP versions will not be compatible with that code, so that it will stop working and finally become history. OPs frustration is with the bad implementation of that particular project, because it reflects badly on PHP.
What if you would simply use nix ?
It's rare when I do it.. but I did yesterday :)
Here is more info about how to install it: https://learn.microsoft.com/en-us/windows/wsl/install
Typical PHP question ๐คฃ
Have you tried intelephense.format.braces? Not sure intelephense also handles HTML, anyway.
See https://github.com/bmewburn/intelephense-docs/blob/master/installation.md#configuration-options
And/or maybe the server is trying to load a file, for which the server has not the correct permissions to read. E.g. the server runs as user www-data and the file is only accessible for some other user. (..too keep the example simple)
In the company, where I work, we use PHP as the glue between backend services (which are written in PHP or another lang - whatever fits the best) and the Frontend. IMO it's this place where PHP is a good fit.
Agreed ๐ฏ
I think about PHP as the tool that glues the stuff together, that has been built with C++ (and other system programming languages).
It's hard to tell with that little information provided. We don't know how big the codebase is, what dependencies it has, if composer is used or not and if a test suite exists. Do you even use git, can you upgrade to PHP 8.1 without upgrading your OS?.. It's even hard to tell with all that info tbh.. because in reality you can only estimate time for a given plan. Your question is the typical part time manager type of question: "how long will the thing take that we don't know how to do yet?".
If experience exist for a task, plans can be plotted quickly based on experience and then time can be estimated. If no experience exists for a particular task yet, I would say do calculate with 2 days for investigation what possibilities exist (you are in this phase right now, I guess - take a look at "rector").
My suggestion would be to install a fork of the project (or the part of it, that needs to be upgraded) on a test environment. <- one point you can estimate how long this would take you
Then try rector to do the upgrade. You could be lucky and rector will convert the code in few seconds. I hope you have a test suite..
Agree
Already did (actually I have some codebases still doing it partially).
Fun fact: It actually works better with WSL1 because in WSL1 there is no native linux kernel involved and Windows could do native FS calls to the WSL1 side and the other way around. In WSL2 the original Linux kernel is used, which has lots of advantages - but the interoperation of FS suffered a lot because native Filesystem calls are not possible anymore - so, for example if the IDE/Editor is running on Windows and is monitoring filesystem events, using the OS native API for file-watching, it is no wonder that it will come to weird results when its watching "linux files"on a netshare with the Windows-native filewatcher :) However, the Jetbrains IDEs has a own Filewatcher API, maybe Jetbrains implements a own filewatcher that works better in this case - I am using SublimeText.
I dont do it that way because of the poor performance. It's ok for little things but for large codebases it simply is not fast enough and also has some quirks sometimes.
You mean to run a GUI App (e.g. a IDE) from inside WSL2? ๐ค yeah, I have not tried it since it became possible - would be worth a try.
WSL2 is the way to go. But you should make sure not to host the codebase on a windows partition that the WSL2 instance reads and writes because this is super slow.
What I do is, I have a git repo on my windows where I do modifications to the code and a 'bare repo' on the Linux side, that serves as a 'git remote' where I push my commits to. On the Linux side I pull it. It sounds more cumbersome that it actually is and with some helper scripts it just works fine.
About the "Apache" part: in the end you will stick to the companies choice but I have the feeling that the world moved to NGINX.