Giter Club home page Giter Club logo

Comments (6)

vletroye avatar vletroye commented on September 6, 2024

This typically happens when the right version of php is not installed. The latest versions of the cgi router in my packages is using php3.0.

Is it installed on your Synology?

from synopackages.

ikalkov avatar ikalkov commented on September 6, 2024

Thank you very much for the prompt answer. We have PHP 7.3 installed and this is what router.cgi script is using /usr/local/bin/php73-cgi (https://github.com/vletroye/SynoPackages/blob/master/MODS%20Sample%20-%20Simple%20CGI/package/ui/router.cgi#L54).

Ist 7.3 is what you mean by php3.0? There is no PHP 3.0 package in Synology Packet Center. I see your last commit in MODS Web Console is named "Fix php page being downloaded instead of executed" and this package is working just fine with our DSM configuration. Should I apply these changes to Simple CGI?

from synopackages.

vletroye avatar vletroye commented on September 6, 2024

Oh yes, sorry.... I was meaning php7.3.

I just reinstalled the latest MODS_Sample_Simple_CGI.spk to be sure... and it's working fine on my Synology...

Another reason why the script is sometimes downloaded : an error during the execution.. Ex.: due to an access denied.

This can happen if the log file may not be written... : LOG="/var/log/@SYNOPKG_PKGNAME@"
Could you check that the two log files exist via ls -la /var/log
-rw-r--rw- 1 root root 333 Jan 8 18:44 MODS_Sample_Simple_CGI
-rw-r--rw- 1 root root 0 Jan 8 18:44 MODS_Sample_Simple_CGI_ERR

Notice: you may only access /var/log if your are connected as root via ssh
drwxr-x--- 16 system log 4096 Jan 8 18:44 log

The execution will also fail if the ini file does not exist: ls -la /usr/local/etc/php73/cli/php.ini
-rw-r--r-- 1 root root 8072 Oct 29 22:06 /usr/local/etc/php73/cli/php.ini

You can do a quick test. As a second line of the router.cgi, type: exit
Now, if the router.cgi is correctly called, you should see a message "Sorry, the page you are looking for is not found." instead of the getting the file downloaded

If you get the message, than the issue is with the router.cgi. Simply comment the line declaring the LOG so you won't have access issue with it.
#LOG="/var/log/@SYNOPKG_PKGNAME@"

Next, try to execute the script (index.php) directly in the console ssh:
/usr/local/bin/php73-cgi -c /usr/local/etc/php73/cli/php.ini -d open_basedir=none /var/packages/MODS_Sample_Simple_CGI/target/ui/index.php

You should get the html page:

Content-type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
  <title>Home | Simple PHP Website</title>
etc....

if you didn't see the message "Sorry, the page you are looking for is not found." but still got the file downloaded, then the pblm is with the web server nor redirecting the call to the router.
First check that you are using Nginx and not apache, as HTTP back-end server.

image

If you are using Nginx, then check that the custom config of the package, for Nginx, is linked to the right location: ls -la /usr/syno/share/nginx/conf.d/dsm.MODS_Sample_Simple_CGI.conf

lrwxrwxrwx 1 root root 57 Jan 8 18:44 /usr/syno/share/nginx/conf.d/dsm.MODS_Sample_Simple_CGI.conf -> /volume1/@appstore/MODS_Sample_Simple_CGI/ui/dsm.cgi.conf

If it is there, then it seems to be not load properly. Restart first Nginx to be sure: synoservicecfg --restart nginx

If it still does not work, did you customize Nginx ? its config should load all dsm.*.conf files under /usr/syno/share/nginx/conf.d/ as you can see via: cat /etc/nginx/nginx.conf | grep syno

include /usr/syno/share/nginx/conf.d/dsm.*.conf;

If all these are fine... I would reboot at least once the Synology...

V.

from synopackages.

vletroye avatar vletroye commented on September 6, 2024

Another stupid trick which worked for me : clear your cache (Ex. within Chrome : your browsing data).

This is especially valid if you installed/uninstalled/re-installed the package and tried it several times...

from synopackages.

ikalkov avatar ikalkov commented on September 6, 2024

Oh, wow. Thanks for the detailed answer, I appreciate it. I'll check tomorrow and report.

from synopackages.

vletroye avatar vletroye commented on September 6, 2024

I had myself a lot of issues when I wrote and tested this technique with nginx ;)

from synopackages.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.