Creating a PHP File


1. Open a text editor (e.g., Notepad, Sublime Text) or an Integrated Development Environment (IDE) like Visual Studio Code.
2. Create a new file and save it with a .php extension (e.g., info.php).
3. Add the following code to the file:

<?php
  // PHP code goes here
?>

1. Write your PHP code inside the <?php and ?> tags.

Basic PHP Information:

- PHP Version: Check the PHP version using php -v in the command line or <?php echo phpversion(); ?> in a PHP file.
- PHP Configuration: Check the PHP configuration using php -i in the command line or <?php phpinfo(); ?> in a PHP file.
- PHP Extensions: Check the installed PHP extensions using php -m in the command line or <?php print_r(get_loaded_extensions()); ?> in a PHP file.

Example PHP File (info.php):

<?php
  // Display PHP version
  echo "PHP Version: " . phpversion() . "<br>";
  
  // Display PHP configuration
  phpinfo();
  
  // Display installed PHP extensions
  print_r(get_loaded_extensions());
?>

Save the file and upload it to your web server's document root directory. Access the file in your web browser to see the PHP information.

Note: Make sure to replace the <?php and ?> tags with the actual PHP code you want to execute. The example above is for displaying PHP information only.

Leave a Reply

Shopping cart0
There are no products in the cart!
Continue shopping
0