Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to enable PHP support on Web Station

#1
Hello,
I just got a DS1522+ running DSM 7.2.1.
After installing Web Station I tried to run a "Hello World!" test web page and it did work as expected.
But when I added to the index.html file the following: "<?PHP phpinfo(); ?>" to validate the PHP support, I didn't see any PHP related details coming out. PHP 7.x and 8.x seem to be installed and running.
When I open the index.html test page with a Chrome developer tool I see my PHP code got changed and commented out:
<!-- ? php phpinfo(); ?--!>

Did I miss any step for having PHP properly running and supported?
Thanks in advance
Fabio
Reply
#2
Verify PHP Installation:

Make sure PHP 7.x or 8.x is installed and enabled on your NAS. You mentioned PHP is installed, but let's ensure it's configured correctly.
Configure Web Station:

Login to DSM (DiskStation Manager) with admin privileges.
Go to Main Menu > Web Station.
Make sure Web Station is enabled. If not, enable it.
Set Up PHP Settings:

In Web Station, go to PHP Settings.
Check that PHP 7.x or 8.x is selected as the default PHP version.
Ensure the PHP module is enabled for your web server (typically Apache or Nginx).
Create a PHP Test File:

Create a new file named info.php in your web server's root directory (usually /web or /var/services/web).
Edit info.php and add the following line:
php
Copy code
<?php
phpinfo();
?>
Save the file.
Access the PHP Test File:

Open a web browser and navigate to http://your-nas-ip/info.php (replace your-nas-ip with the actual IP address or hostname of your NAS).
If PHP is properly configured, you should see a PHP info page with details about your PHP installation.
Check File Permissions:

Ensure that the file permissions for info.php allow the web server to read and execute it. Typically, permissions should be set to 644 (rw-r--r--).
Clear Browser Cache:

Sometimes, cached content can cause issues. Clear your browser cache or try accessing the PHP test file in an incognito/private window.
Verify HTML Code:

Ensure that in your HTML file (e.g., index.html), PHP code is enclosed correctly within <?php ... ?> tags. The PHP tags <?PHP ... ?> are not valid; use lowercase <?php ... ?>.
Restart Services:

After making changes to PHP settings or configuration files, restart the web server service through DSM to apply the changes.
Review PHP Error Logs:

Check PHP error logs on your NAS (/var/log/phpX.X-fpm.log where X.X is your PHP version) for any errors or warnings that might indicate configuration issues.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)