I recently set up a web server on my Kali Linux 2023.1 virtual machine to practice PHP scripting. However, I'm facing an issue where the variables in my PHP script are not being displayed on the web server. I have tried several troubleshooting steps but haven't been successful so far.
Here's some context to provide a better understanding:
1. Environment: I'm using Kali Linux 2023.1 as a virtual machine on my computer.
2. Goal: My goal is to run a simple PHP script on the web server, which should display the values of some variables on the webpage.
3. Server Setup: I have successfully set up Apache web server on my Kali Linux VM and confirmed that it is running fine. I can access the default Apache webpage through my local IP.
4. PHP Script: I have created a basic PHP script with some variables that I want to display on the web server. The script doesn't involve any database connections or complex logic, just basic variable assignments and echo statements.
5. Issue: When I access the PHP script through the web server, the variables are not being displayed on the webpage. I only see a blank page or the default Apache webpage.
Things I have tried so far (without success):
1. Verified PHP installation: I have confirmed that PHP is installed on my system using the `php -v` command in the terminal. The output shows the correct version of PHP.
2. File location and permissions: I have placed my PHP script in the `/var/www/html` directory, as recommended for Apache web server. The file has the proper permissions set (read and execute), and is owned by the www-data user.
3. Enabled PHP module: I have ensured that the PHP module is enabled in Apache by using the `a2enmod php` command and restarting Apache afterwards using `service apache2 restart`.
4. Error reporting: I have enabled error reporting in the PHP script by adding `error_reporting(E_ALL); ini_set('display_errors', 1);` at the top of my PHP script. However, I don't see any error messages on the webpage.
5. Confirmed syntax: I have reviewed the PHP script multiple times to check for any syntax errors or typos. It appears to be correct.
Despite these efforts, I'm still unable to see the variables displayed on the webpage. I'm not sure what I might be missing or if there is any additional configuration I need to do.
Any help or suggestions would be greatly appreciated!
Thank you in advance.