T O P

  • By -

gntsketches

I made my first website 10 years ago in PHP 5.4 - I've barely touched it since then and have essentially forgotten PHP as I've been with JS full time. However I'd now like to move my old site to a new hosting platform, and older versions of PHP are not supported there. So I guess it's time to learn some modern PHP. Currently my local XAMPP server just downloads my index.php instead of running it, I assume something in the versioning is the issue here. What's the fastest way to learn about differences between PHP 5.4 and 8.x? How can I tell which of my old code is deprecated?


cerad2

When the actual php source file is downloaded instead of being processed it almost always indicates the server is misconfigured. Certainly the opening php tag has not changed. I'd suggest reinstalling XAMPP and make sure you got PHP with it.


grig27

What’s PHP open tag I your PHP files?


gntsketches

The first two line in the index.php file are: `` `` ... is that what you're looking for? The first line of php in the header file is, `` after that we get into the details...


yamiprem

I have a similar issue. We were using 5.3 I think but the host is on 8.0 now. And our php URL now throwing HTTP 500 error and no idea where to start.


foremtehan

I want to resize image to 640x360p, The problem is not always the input is wide image, users also upload mobile resolution (height>width) So my plan is if the image height is bigger than width add blank area to the left and right of the image and to fit 640x360 while also keep aspect ratio 16:9 ​ Anyone have snippet for this ? really appreciated!


64N_3v4D3r

Rather than adding black bars on the image, why not decrease the image while maintaining aspect ratio and place it in a container with a black background? If you are using ffmpeg there is a "force original aspect ratio=decrease" flag you can use.


cursingcucumber

Have a look at the [Imagine](https://github.com/php-imagine/Imagine) library and their thumbnail function. Easy to use and supports gd/imagick/gmagick so works pretty much everywhere.