Difference between revisions of "Phpinfo page"

From TheBestLinux.com
Jump to navigation Jump to search
Line 1: Line 1:
 +
== '''PHP - Website scripting language used to create dynamic websites''' ==
 +
 +
=== '''Custom PHP Distributions - 3rd Party''' ===
 +
There are a number of custom PHP distributions out there, usually created for specific use-cases.  Others are great when you need a newer version of PHP that what is naitively available for your current version of your Linux distribution.
 +
 +
For instance, the new website app you want to use on your website requires PHP 8.2, but your version of Linux only has PHP 7.4 available through it's normal package repository.  There are third-party custom PHP distributions created by these developers that allow you to install the newer version of PHP and it's supported accessories and tools.
 +
<br /><br />
 +
 +
=== '''Upgrading Third-Party Custom PHP Distribution Repository Configurations''' ===
 +
As new software packages and tools become available, so do thier PHP requirements.  What once needed PHP 7.4 to run properly now needs PHP version 8.2 to run the new version of the package required.  In order to do this properly and keep the system "clean", configured "correctly", you should follow the "standard process" for the particulare package you are dealing with, as all are different, depending on what you are wanting to do in the end.
 +
 +
==== '''PHP Upgrade - Real-World Urgent Upgrade Required!''' ====
 +
I currently encounreded a real-world urgent upgrade requirement for the currently installed version of PHP on my Fedora 36 workstation laptop with this exact same scenario.  I had installed the YUM/DNF PHP repository configuration files for the 3rd-party "Remi php 7.4" packages long ago, when it was the newest available version, and Fedora 36 didn't support any PHP higher than 5.x at the time.  Long since then, I have begun to get warning messages on that laptop aobut the outdated and extremely "vulnerable" PHP version 7.4 installed, and that I should upgrade immediatelly.
 +
<br /><br />
 +
 +
I had to figure out how to upgrade the Remi repository configuration files to support the latest version of PHP currently available through Remi, and went through this process:
 +
 +
<pre style="color:blue">
 +
[root@fc36.dawgland.com:~]# dnf module reset php
 +
Fedora 36 - x86_64 - Updates                    8.5 kB/s | 4.5 kB    00:00   
 +
Fedora Modular 36 - x86_64 - Updates            7.4 kB/s | 2.3 kB    00:00   
 +
Dependencies resolved.
 +
================================================================================
 +
Package          Architecture    Version            Repository        Size
 +
================================================================================
 +
Resetting modules:
 +
php                                                                         
 +
 +
Transaction Summary
 +
================================================================================
 +
 +
Is this ok [y/N]: y
 +
</pre>
 +
<br /><br />
 +
 +
 +
 
* Using the text editor of your choice(I prefer vi/vim, but newbies like pico), create a new file named phpinfo.php, or anything you want, as long as it ends with the .php filename extension, in the root directory of your web server.  On Linux, that us usually /var/www/html.  Within that file, enter these three lines of text:
 
* Using the text editor of your choice(I prefer vi/vim, but newbies like pico), create a new file named phpinfo.php, or anything you want, as long as it ends with the .php filename extension, in the root directory of your web server.  On Linux, that us usually /var/www/html.  Within that file, enter these three lines of text:
 
<pre style="color:blue">
 
<pre style="color:blue">

Revision as of 03:34, 2 November 2023

PHP - Website scripting language used to create dynamic websites

Custom PHP Distributions - 3rd Party

There are a number of custom PHP distributions out there, usually created for specific use-cases. Others are great when you need a newer version of PHP that what is naitively available for your current version of your Linux distribution.

For instance, the new website app you want to use on your website requires PHP 8.2, but your version of Linux only has PHP 7.4 available through it's normal package repository. There are third-party custom PHP distributions created by these developers that allow you to install the newer version of PHP and it's supported accessories and tools.

Upgrading Third-Party Custom PHP Distribution Repository Configurations

As new software packages and tools become available, so do thier PHP requirements. What once needed PHP 7.4 to run properly now needs PHP version 8.2 to run the new version of the package required. In order to do this properly and keep the system "clean", configured "correctly", you should follow the "standard process" for the particulare package you are dealing with, as all are different, depending on what you are wanting to do in the end.

PHP Upgrade - Real-World Urgent Upgrade Required!

I currently encounreded a real-world urgent upgrade requirement for the currently installed version of PHP on my Fedora 36 workstation laptop with this exact same scenario. I had installed the YUM/DNF PHP repository configuration files for the 3rd-party "Remi php 7.4" packages long ago, when it was the newest available version, and Fedora 36 didn't support any PHP higher than 5.x at the time. Long since then, I have begun to get warning messages on that laptop aobut the outdated and extremely "vulnerable" PHP version 7.4 installed, and that I should upgrade immediatelly.

I had to figure out how to upgrade the Remi repository configuration files to support the latest version of PHP currently available through Remi, and went through this process:

[root@fc36.dawgland.com:~]# dnf module reset php
Fedora 36 - x86_64 - Updates                    8.5 kB/s | 4.5 kB     00:00    
Fedora Modular 36 - x86_64 - Updates            7.4 kB/s | 2.3 kB     00:00    
Dependencies resolved.
================================================================================
 Package           Architecture     Version             Repository         Size
================================================================================
Resetting modules:
 php                                                                           

Transaction Summary
================================================================================

Is this ok [y/N]: y




  • Using the text editor of your choice(I prefer vi/vim, but newbies like pico), create a new file named phpinfo.php, or anything you want, as long as it ends with the .php filename extension, in the root directory of your web server. On Linux, that us usually /var/www/html. Within that file, enter these three lines of text:
<?php
phpinfo()
?>



Here's the scrollback of me doing it on one of my VM's (Kind of a mini-tutorial on VI~!):

[jamie@cos8vm8.dawgland.com:~]$ cd /var/www/html/
[jamie@cos8vm8.dawgland.com:/var/www/html]$ sudo vi phpinfo.php



I then hit the "ENTER" key, taking me into a blank page, as seen here:


~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
"phpinfo.php" [New File]

At this point, I'm in Vi's "command" mode, so I need to tap the "I" key to put me into "Insert" mode. Then, I can type in the 3 required lines:

<?php
phpinfo()
?>



I then need to get out of "Insert" mode within VI/VIM(VIM=Vi Improved), so I tap the "Escape" key to do that, taking me back to "command" mode(there is no prompt or notification you have changed modes - you just need to know what you are doing, which is why most newbies don't care much for VI/VIM!). Once back in "command" mode, most VI guys use the colon and then the "w" key to "write" the file, and the "q" key to quit VI, such as ":wq", without the quotes in my example. The beauty and power of VI is modern versions allow you to use ":x" without the quotes, to exit and save in one command, the "x" command! Here is the screenshot of me doing so:

<?php
phpinfo()
?>

~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
:x



Once saved, and as long as you've already installed and configured PHP to work with your web server, you can then check it out at http://your-website-address/phpinfo.php and you should see a page similar to this:

Error creating thumbnail: File missing


[jamie@cos8vm8.dawgland.com:/var/www/html]$