openemr / openemr

The most popular open source electronic health records and medical practice management solution.
https://open-emr.org/
GNU General Public License v3.0
3.2k stars 2.16k forks source link

full support for nginx/php-fpm #1696

Open bradymiller opened 6 years ago

bradymiller commented 6 years ago

See this forum for details: https://community.open-emr.org/t/openemr-lemp-on-freebsd/10283/15

TODO:

gutiersa commented 6 years ago

@bradymiller The administration module shows 404 by default. Nginx can be configured to

allow access freely, (but this is a security vulnerability as there is no password authentication for admin in openemr). For free access you can remove or (comment out) this block:

 location ~* ^/(admin|setup|acl_setup|acl_upgrade|sl_convert|sql_upgrade|gacl/setup|ippf_upgrade|sql_patch)\.php {
        auth_basic              "Restricted Access"; 
        auth_basic_user_file    /path/to/.htpasswd;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
        fastcgi_pass php; 
        include fastcgi_params; 
       }

block access altogether by uncommenting this block (and commenting the block above):

 # If you pick this block, be sure to comment the previous one
 # Alternatively all access to these files can be denied
 #location ~* ^/(admin|setup|acl_setup|acl_upgrade|sl_convert|sql_upgrade|gacl/setup|ippf_upgrade|sql_patch)\.php { 
      # deny all; 
      # return 404; 
      #}

or password protect the administrative files by using the first block above and setting up password files.

gutiersa commented 6 years ago

@bradymiller " Use strategy in above step to get the new patient portal to work"

I'll get on it this week

gutiersa commented 6 years ago

@bradymiller " Full testing (For the development docker environment, I think I got them all, but some php dependencies may be missing: "

Yes, I do have all those PHP72 extensions.

bradymiller commented 6 years ago

@gutiersa ,

I think this issue "Get Administration->Modules to work (now shows 404 Not Found nginx/1.15.0)" stems from use of following .htaccess file in the Zend modules: https://github.com/openemr/openemr/blob/master/interface/modules/zend_modules/public/.htaccess (note the new patient portal also does the same sort of thing)

In the debian package I did actually also need to address this for apache since it was using a alias (migrated it from .htaccess to the apache conf file): https://github.com/openemr/openemr/blob/master/contrib/util/ubuntu_package_scripts/production/openemr.conf#L6-L20 (I am not sure how to migrate that over to nginx, but at least is a starting point for you)

-brady

gutiersa commented 6 years ago

@bradymiller It is not an issue at all. I designed it that way, look at my replies above. (sorry, I did not add @bradymiller before, I just did)

On Sun, Jun 10, 2018 at 7:04 PM Brady Miller notifications@github.com wrote:

@gutiersa https://github.com/gutiersa ,

I think this issue "Get Administration->Modules to work (now shows 404 Not Found nginx/1.15.0)" stems from use of following .htaccess file in the Zend modules: https://github.com/openemr/openemr/blob/master/interface/modules/zend_modules/public/.htaccess (note the new patient portal also does the same thing)

In the debian package I did actually also need to address this for apache since it was using a aliad (migrated it from .htaccess to the apache conf file):

https://github.com/openemr/openemr/blob/master/contrib/util/ubuntu_package_scripts/production/openemr.conf#L6-L20 (I am not sure how to migrate that over to nginx, but at least is a starting point for you)

-brady

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396089059, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjv9VlxIjQSC-oCwA1d37FqJiLpyCks5t7aX3gaJpZM4Uh5ID .

bradymiller commented 6 years ago

@gutiersa , On the dockerized development version, I don't have any of those security options on, though, and still getting the error: https://github.com/openemr/openemr/blob/master/contrib/util/docker/stuff/configs/nginx/nginx.conf#L112-L126

bradymiller commented 6 years ago

btw @gutiersa , the other issue I just added, "Administration->Backup is broken and shows" is likely not a problem for your setup since you likely have mysql installed on your os. This is something I will sort out on the development docker approach (I need to add mysql support to the php-fpm docker).

gutiersa commented 6 years ago

I see. I thought you meant admin.php ok Anything I can help with? Which is your database? I have a test server. Or, what error are you getting?

On Sun, Jun 10, 2018 at 8:28 PM Brady Miller notifications@github.com wrote:

btw, the "Administration->Backup is broken and shows" is likely not a problem for your setup since you likely have mysql installed on your os. This is something I will sort out on the development docker approach (I need to add mysql support to the php-fpm docker).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396094297, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjtQat4llXoT1zgXP5kA-TsEJs2TNks5t7bmlgaJpZM4Uh5ID .

bradymiller commented 6 years ago

hi @gutiersa , On your environment, what happens in OpenEMR when you go to Modules->Manage Modules? (btw, sorry for the confusion on this, it's not Administration->Modules, but is Modules->Manage Modules) -brady

gutiersa commented 6 years ago

where in globals? I can send you the link. How can I get your email? I don't have any patient data

On Sun, Jun 10, 2018 at 8:46 PM Brady Miller notifications@github.com wrote:

hi @gutiersa https://github.com/gutiersa , On your environment, what happens in OpenEMR when you go to Modules->Manage Modules? -brady

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396095487, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjjqFvXTHwfluthjdKbe7UWNI9H97ks5t7b36gaJpZM4Uh5ID .

gutiersa commented 6 years ago

nvm, got it

On Sun, Jun 10, 2018 at 9:16 PM gutiersa . gutiersa1@gmail.com wrote:

where in globals? I can send you the link. How can I get your email? I don't have any patient data

On Sun, Jun 10, 2018 at 8:46 PM Brady Miller notifications@github.com wrote:

hi @gutiersa https://github.com/gutiersa , On your environment, what happens in OpenEMR when you go to Modules->Manage Modules? -brady

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396095487, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjjqFvXTHwfluthjdKbe7UWNI9H97ks5t7b36gaJpZM4Uh5ID .

gutiersa commented 6 years ago

@bradymiller I get page not found also

On Sun, Jun 10, 2018 at 8:46 PM Brady Miller notifications@github.com wrote:

hi @gutiersa https://github.com/gutiersa , On your environment, what happens in OpenEMR when you go to Modules->Manage Modules? -brady

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396095487, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjjqFvXTHwfluthjdKbe7UWNI9H97ks5t7b36gaJpZM4Uh5ID .

gutiersa commented 6 years ago

@bradymiller

well this file doesn't really exist in my version of openemr: /interface/modules/zend_modules/public/Installer there is /interface/modules/zend_modules/public/js/installer, but not ../Installer It is not found because there is no such directory in my distribution

On Sun, Jun 10, 2018 at 9:22 PM gutiersa . gutiersa1@gmail.com wrote:

I get page not found also Sandragutierrezmd

On Sun, Jun 10, 2018 at 8:46 PM Brady Miller notifications@github.com wrote:

hi @gutiersa https://github.com/gutiersa , On your environment, what happens in OpenEMR when you go to Modules->Manage Modules? -brady

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396095487, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjjqFvXTHwfluthjdKbe7UWNI9H97ks5t7b36gaJpZM4Uh5ID .

gutiersa commented 6 years ago

@bradymiller trying a backup gives me this message:

Dumping OpenEMR database... "/usr/bin/mysqldump -u 'user' -p'password' -h 'localhost' --port='3306' --opt --quote-names -r /tmp/openemr_web_backup/emr_backup/openemr.sql 'openemr'" returned 127:

and I am running mysql 5.7

gutiersa commented 6 years ago

@bradymiller

event log backup gives this message: "/usr/bin/mysqldump -u 'user' -p'password' -h 'localhost' --port='3306' --opt --quote-names -r /tmp/emr_eventlog_backup/eventlog_20180611_014311.sql 'openemr' --tables log_comment_encrypt_backup log_backup log_validator_backup" returned 127:

bradymiller commented 6 years ago

hi @gutiersa , For the backup log issue in the dev dockers, I just fixed this by including mysql support in the php-fpm docker(https://github.com/openemr/openemr/commit/2ef3d392f5578424750fa381887e8bc71e17b35e). In your case, mysql is already supported in your host, so guessing it may be the path to mysql /usr/bin/ that is wrong which you can set at Administration->Globals->Miscellaneous->Path to MySQL Binaries

gutiersa commented 6 years ago

@bradymiller I need a reminder on these rewrite rules:

RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Is this just removing the js directory? because nginx does not need this at all:

Rewrite engine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

It is already taken care by:

location / { 
    try_files $uri $uri/ /index.html
}

which means try it as a file, try it as a directory if not go to the index page

gutiersa commented 6 years ago

@bradymiller hmm, nginx already knows the path to mysql, but I will double check. Does openemr use environmental variables?

bradymiller commented 6 years ago

@gutiersa , The issue here is that, the php script is directly calling a command line command (which happens to be mysql in this case), so what php or nginx know won't help it.

And that apache rewrite stuff has always appeared to be gibberish to me :) edit: btw, the nginx way of doing this seems much more readable

bradymiller commented 6 years ago

Regarding path for freebsd, maybe try: /usr/local/bin/mysqldump or even just leave the path blank maybe

gutiersa commented 6 years ago

@bradymiller the log backup worked fine, I added the paths in globals but for backing up the directory I got this:

Dumping OpenEMR web directory tree... "tar --same-owner --ignore-failed-read -zcphf /tmp/openemr_web_backup/emr_backup/openemr.tar.gz "library" "acl_setup.php" "common" "interface" ".editorconfig" "portal" "controllers" "controller.php" "ci" "config" "entities" ".github" "version.php" "images" "sql_upgrade.php" "acl_upgrade.php" "Documentation" "modules" "admin.php" "docker-compose.yml" "vendor" "composer.lock" "public" "composer.json" "acknowledge_license_cert.html" "custom" "templates" "5-0-1-Patch-3.zip" "tests" "sql" "ippf_upgrade.php" "build.xml" "cloud" ".gitignore" "CODE_OF_CONDUCT.md" "303e2141623a156180431a1a1bc23bf7.html" "index.php" "setup.php" "README.md" "repositories" "bower.json" "ccdaservice" "CONTRIBUTING.md" "sql_patch.php" "gacl" "contrib" "myportal" "sites/011" "ccr" ".travis.yml" ".bowerrc" "services" "LICENSE" ".env.example" "phpfhir" "patients"" returned 1:

What does it mean? It did do the back up though

gutiersa commented 6 years ago

@bradymiller re:

The issue here is that, the php script is directly calling a command line command (which happens to be mysql in this case), so what php or nginx know won't help it.

Yes, but PHP knows better, it should use the environmental variables. Leaving it blank does not work.

bradymiller commented 6 years ago

@gutiersa ,

ensure you have tar and perl installed on your host.

ensure perl path is correct at: Administration->Globals->Miscellaneous->Path to Perl Binaries

ensure you have adequate permissions to the directory at: Administration->Globals->Miscellaneous->Path to Temporary Files Administration->Globals->Miscellaneous->Path for Event Log Backup

gutiersa commented 6 years ago

@bradymiller re: "And that apache rewrite stuff has always appeared to be gibberish to me"

Well, here is the problem with the modules: nginx is looking for: /interface/modules/zend_modules/public/Installer but there is no such directory in OpenEMR. However, there is a lower case installer in the /interface/modules/zend_modules/public/js directory.

This is why the module installer is not working

gutiersa commented 6 years ago

yes, I have them the path is correct, I checked it

gutiersa commented 6 years ago

I am trying to figure out the rewrite rules for the Zend engine modules. What happens in interface/modules/zend_modules/public/index.php ? When I go there, I get this error message:

A 404 error occurred Page not found. The requested URL could not be matched by routing.

No Exception available

Looks like the Zend engine.

sjpadgett commented 6 years ago

Hey guys, remember the CCM stuff usually run a REST interface. The public/index routes to an action index function so /interface/modules/zend_modules/public/Installer is really routed through public/index.php(default landing). The url is parsed in index.php.

gutiersa commented 6 years ago

@sjpadgett and what is the result? nginx passes all the arguments. I'll try specifically, in that directory to pass an argument, but I am not sure.

sjpadgett commented 6 years ago

Well for installer it is a module. So the index will route to init function to setup application/services/events e.t.c. then route to installer module. Really should not need to do anything to .htaccess or urls. The 404 i've seen before but just have to remember what. I'm thinking.....still thinking....

sjpadgett commented 6 years ago

@gutiersa Have you checked if you are getting any errors in php error log? also, what is the exacy url from console?

bradymiller commented 6 years ago

hi @gutiersa and @sjpadgett ,

Just to take a step back for a bit on the rewrite stuff. Don't we just need to convert the below rewrite rules to nginx's rules: https://github.com/openemr/openemr/blob/master/contrib/util/ubuntu_package_scripts/production/openemr.conf#L6-L20 (note both of the directories highlighted in above code block have .htaccess scripts in them with these same rewrite rules)

-brady

bradymiller commented 6 years ago

btw, in line with above comment, here is the rewrite .htaccess for zend: https://github.com/openemr/openemr/blob/master/interface/modules/zend_modules/public/.htaccess

and here is the rewrite .htaccess for patient portal: https://github.com/openemr/openemr/blob/master/portal/patient/.htaccess

(these are simpler to understand I think than my code block above which was necessary to deal with an apache alias issue)

bradymiller commented 6 years ago

oh my goodness, check out this awesome friggin tool: https://winginx.com/en/htaccess

Just copy/paste in the above 2 different .htaccess scripts and I think you may get your answers :)

bradymiller commented 6 years ago

hmm, is it more correct to say awesome friggin or friggin awesome

sjpadgett commented 6 years ago

Forgot this is nginx definitely would say rewrite is problem. Also, friggin doesn't apply unless the subject is self administrating oneself! English slang.

gutiersa commented 6 years ago

@bradymiller @sjpadgett nice tool but rewrite is not that big a problem. If I understand it correctly, Nginx already processes code as if there was an .htaccess file in every directory, with the basic rewrite rule "RewriteRule ^.*$ - [NC,L]" ie the location statement: "location / {}" It's actually kind of genius. I tell you, you are going to be hooked, if we can fix this.

gutiersa commented 6 years ago

@bradymiller @sjpadgett It would look something like this:

location /this-is-what-I-cant-figure-out {
  root /path/to/openemr/interface/modules/zend_modules/public;
  try_files $uri =404;
  send-everything-else-to-the-upstream-php-fpm;
}
gutiersa commented 6 years ago

@bradymiller how about "Installer"?

location ~ /interface/modules/zend_modules/public/Installer {
  root /path/to/openemr/interface/modules/zend_modules/public;
  try_files $uri =404;
  send-everything-else-to-the-upstream-php-fpm;
}
gutiersa commented 6 years ago

did not work either

bradymiller commented 6 years ago

regarding path, should focus on /interface/modules/zend_modules/public , since zend has more than just the Installer module

how about based on this solution: https://stackoverflow.com/questions/23481058/apache-rewrite-rule-to-nginx-for-hhvm?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

    location /interface/modules/zend_modules/public {
        server_tokens off;
        try_files $uri $uri/ /index.php?$args;
    }
bradymiller commented 6 years ago

In above example, also looks like the fastcgi_param is a little different

gutiersa commented 6 years ago

server_tokens off;

is not needed because all the location statements will inherit it. Also nginx arlready passes arguments automatically. I knwo the ?$args is needed in wordpress due to the pretty permalinks. what I need is to figure out how to bypass js folder.

Sandragutierrezmd

On Mon, Jun 11, 2018 at 9:23 AM Brady Miller notifications@github.com wrote:

In above example, also looks like the fastcgi_param is a little different

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396241426, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjhaEj5zrZL184mFmCFClEqtXJSC2ks5t7m85gaJpZM4Uh5ID .

gutiersa commented 6 years ago

I'm at the office, but the site is blocked. what does the fastcgi_param look like? Sandragutierrezmd

On Mon, Jun 11, 2018 at 9:30 AM gutiersa . gutiersa1@gmail.com wrote:

server_tokens off;

is not needed because all the location statements will inherit it. Also nginx arlready passes arguments automatically. I knwo the ?$args is needed in wordpress due to the pretty permalinks. what I need is to figure out how to bypass js folder.

Sandragutierrezmd

On Mon, Jun 11, 2018 at 9:23 AM Brady Miller notifications@github.com wrote:

In above example, also looks like the fastcgi_param is a little different

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openemr/openemr/issues/1696#issuecomment-396241426, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyGjhaEj5zrZL184mFmCFClEqtXJSC2ks5t7m85gaJpZM4Uh5ID .

gutiersa commented 6 years ago

@bradymiller @sjpadgett Could this be an authentication issue? this is what I get in my error log:

PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/themes/themeBuilder.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:46 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/main/tabs/main.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:57 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "POST /library/ajax/dated_reminders_counter.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:57 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "POST /library/ajax/execute_background_services.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:58 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "POST /interface/main/dated_reminders/dated_reminders.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:59 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/login/login.php?site=default HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:21:59 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/themes/themeBuilder.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:11 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/login/login.php?site=default HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:12 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/themes/themeBuilder.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:15 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: language_direction in /path/to/openemr/library/core/src/Header.php on line 129 PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/login/login.php?site=016 HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:15 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: authUser in /path/to/openemr/library/auth.inc on line 84 PHP message: PHP Notice: Undefined index: authProvider in /path/to/openemr/library/auth.inc on line 84" while reading response header from upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/themes/themeBuilder.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:17 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/main/tabs/main.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net" 2018/06/11 11:22:28 [error] 75164#100750: 953 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: basePath in /path/to/openemr/library/core/src/Header.php on line 158" while reading upstream, client: xx.xx.xx.xx, server: domain.net, request: "GET /interface/main/tabs/main.php HTTP/2.0", upstream: "fastcgi://unix:/path/to/php-fpm.sock:", host: "domain.net"

sjpadgett commented 6 years ago

These are common notice's for OpenEMR(depending on PHP version) indicating maybe a conditional that failed because array element didn't exist or function call without an expected param. Looks like the scripts are called okay tho. I'd turn off notices

gutiersa commented 6 years ago

@sjpadgett Ok, I will. But I need to get an idea of which uri gets passed to the server so I can come up with the location block, or the rewrite rule. I am just not familiar with js. what can I print to the screen or the logs in /interface/modules/zend_modules/public/index.php ?

this did not work either:

location ~ ^/interface/modules/zend_modules/public/Installer {
   root /path/to/openemr/interface/modules/zend_modules/public;
   try_files $uri /index.php;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   fastcgi_pass php;
   include fastcgi_params;
}
gutiersa commented 6 years ago

I need an example of what this would look like:

"url":"/interface/modules/zend_modules/public/Installer","children":[],"requirement":0,"acl_req":["admin","manage_modules"]}],"requirement":0,"acl_req":["menus","modle"]}

sjpadgett commented 6 years ago

@gutiersa Not sure what you are after but the uri is parsed in index.php to determine the controller/trigger e.t.c. and passed aong to app run. I can say that option Multiview should be turned off. Here is server details after rewrite if it will help: 'SERVER_SOFTWARE' => 'Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.1.7RC1', 'SERVER_NAME' => 'localhost', 'SERVER_ADDR' => '::1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '::1', 'DOCUMENT_ROOT' => 'C:/xampp/htdocs', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => 'C:/xampp/htdocs', 'SERVER_ADMIN' => 'postmaster@localhost', 'SCRIPT_FILENAME' => 'C:/xampp/htdocs/openemr/interface/modules/zend_modules/public/index.php', 'REMOTE_PORT' => '60716', 'REDIRECT_URL' => '/openemr/interface/modules/zend_modules/public/Installer', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/openemr/interface/modules/zend_modules/public/Installer', 'SCRIPT_NAME' => '/openemr/interface/modules/zend_modules/public/index.php', 'PHP_SELF' => '/openemr/interface/modules/zend_modules/public/index.php',

gutiersa commented 6 years ago

@sjpadgett Yes, that is it. what arguments, if any,are passed to the installer? I am trying to come up with the equivalent of "RewriteRule ^.*$ /openemr/interface/modules/zend_modules/public/index.php [NC,L]"

sjpadgett commented 6 years ago

Here is a carecoordination module call: 'SERVER_SOFTWARE' => 'Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.1.7RC1', 'SERVER_NAME' => 'localhost', 'SERVER_ADDR' => '::1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '::1', 'DOCUMENT_ROOT' => 'C:/xampp/htdocs', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => 'C:/xampp/htdocs', 'SERVER_ADMIN' => 'postmaster@localhost', 'SCRIPT_FILENAME' => 'C:/xampp/htdocs/openemr/interface/modules/zend_modules/public/index.php', 'REMOTE_PORT' => '61223', 'REDIRECT_URL' => '/openemr/interface/modules/zend_modules/public/carecoordination/index', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/openemr/interface/modules/zend_modules/public/carecoordination/index', 'SCRIPT_NAME' => '/openemr/interface/modules/zend_modules/public/index.php', 'PHP_SELF' => '/openemr/interface/modules/zend_modules/public/index.php' And a call for CCD with url query string: 'SCRIPT_FILENAME' => 'C:/xampp/htdocs/openemr/interface/modules/zend_modules/public/index.php', 'REMOTE_PORT' => '61300', 'REDIRECT_URL' => '/openemr/interface/modules/zend_modules/public/encounterccdadispatch/index', 'REDIRECT_QUERY_STRING' => 'combination=44&view=1&recipient=self&param=1', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'combination=44&view=1&recipient=self&param=1', 'REQUEST_URI' => '/openemr/interface/modules/zend_modules/public/encounterccdadispatch/index?combination=44&view=1&recipient=self&param=1', 'SCRIPT_NAME' => '/openemr/interface/modules/zend_modules/public/index.php', 'PHP_SELF' => '/openemr/interface/modules/zend_modules/public/index.php',

The way I look at this is that whatever uri is given to index.php via rewrite(actually nothing really gets rewritten (unless a file, I believe) but merely index.php is called), index.php leaves uri alone and calls the application init function where the uri is parsed and dealt with concerning routing. Also, the index in the uri is not index.php but the action index called from routing. Maybe this helps as I just don't do nginx