Challenge - 5 Problems
PHP Installation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Output of PHP Version Check
What is the output of this PHP code snippet when run on a properly installed PHP 8.1 environment?
PHP
<?php
echo PHP_VERSION;
?>Attempts:
2 left
💡 Hint
PHP_VERSION is a predefined constant that holds the current PHP version as a string.
✗ Incorrect
The PHP predefined constant PHP_VERSION outputs the current PHP version as a string, such as '8.1.0'. It does not output the literal string 'PHP_VERSION'.
❓ Predict Output
intermediate1:30remaining
Result of phpinfo() Function
What does the phpinfo() function output when called in a PHP script?
PHP
<?php phpinfo(); ?>
Attempts:
2 left
💡 Hint
phpinfo() outputs configuration info about PHP in HTML format.
✗ Incorrect
phpinfo() outputs a detailed HTML page that shows PHP version, configuration, loaded modules, environment variables, and more.
❓ Predict Output
advanced1:30remaining
Behavior of PHP Script Without Closing Tag
What happens if a PHP script file ends without the closing ?> tag?
PHP
<?php echo 'Hello, world!';
Attempts:
2 left
💡 Hint
PHP closing tag is optional at the end of a file.
✗ Incorrect
In PHP, the closing ?> tag at the end of a file is optional and omitting it prevents accidental whitespace output. The script runs normally.
❓ Predict Output
advanced1:30remaining
Output of PHP Script with Short Open Tag Disabled
Given the following PHP code and assuming short_open_tag is disabled in php.ini, what will be the output?
PHP
<?php echo 'Test'; ?>
Attempts:
2 left
💡 Hint
Short open tags require short_open_tag enabled in php.ini.
✗ Incorrect
If short_open_tag is disabled, PHP does not recognize '' as a PHP opening tag, so the code is treated as plain text and output literally.
🧠 Conceptual
expert2:00remaining
Understanding PHP Configuration File Location
Where does PHP look for its main configuration file (php.ini) by default when installed on a Linux system?
Attempts:
2 left
💡 Hint
PHP version and SAPI (like CLI or Apache) affect the php.ini location.
✗ Incorrect
On many Linux systems, PHP stores version-specific configuration files under /etc/php/{version}/{sapi}/php.ini, for example /etc/php/8.1/cli/php.ini for CLI PHP 8.1.