Datadog collects and monitors your PHP app metrics and distributed traces in real-time with application performance monitoring. Decrease downtime and performance issues with Datadog APM by tracing requests across service boundaries and drilling into individual traces end-to-end with flame graphs. Start your 14-day trial for free today.
When working on open source code, I like using the latest version of PHP. When developers that are not on the latest version use the package, they might see syntax errors.
You might ask why Composer doesn't protect against this? When composer.json requires the latest version, how do devs, not on the latest version, can even install the package?
Well, there seemingly are a lot of people that only upgrade the PHP version on the command line. For handling web requests, they are unknowingly using an older version of PHP. Here's how to make sure you are on the latest version of PHP on both the CLI and for handling web requests.
On the CLI type this command to see your PHP version:
To check the PHP version that handles web requests, create a
.php file with this content somewhere the public directory of your app.
Point your browser to that file. You will now see which version of PHP you are running. Don't forget to delete the file afterward.
Follow me on Twitter. I regularly tweet out programming tips, and what I myself have learned in ongoing projects.
Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer.
Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.
Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.
Could I just dd(phpinfo()) ?
That assumes composer install always runs on the Target machine, or at least on a machine with the same version of PHP.
That's not always the case.
It's actually hard to believe such a post is needed. PHP newbies usually don't know WTF are Git and GitHub.
This is good idea,pls if i may ask how to upgrade cli php version to the latest or from one version to the other, i have google searched this alot but i have not found any resourceful answer thank you
Ahh that makes sense I wondered why this post came up but got it now!
Thanks for sharing ...
We are all newbies at anytime, as we move in different directions, tools and platforms.
How about linking to it as part of the issue template?
If you want to go the extra mile, adding how to fine which binary you're using and how to find the ini file is also a must for PHP development in my opinion anyways
If you want to check your "web requests" PHP version from command line, usually (it depends on the server configuration) you can do something likes this:
curl -vk http://localhost 2>&1 | grep "X-Powered-By"
Well, for some people, that’s not enough.
I always just check on composer.json file for php dependency version.
on terminal by doing php -v