Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Can't get test plugin PHP to work

Featured Replies

I am trying to write a plugin and just starting out with a simple test. I am trying to reverse engineering the dynamix autofan plugin. I removed the PHP from the page file and put in another PHP script:
https://github.com/prasathmani/tinyfilemanager/blob/master/tinyfilemanager.php
I keep getting a parsing error:
Parse error: syntax error, unexpected end of file in /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php(522) : eval()'d code on line 4141

However, I can run the PHP just fine on a dev webserver. I'm not sure what the matter is. I simply removed everything below --- in the page file and copied and pasted the PHP. As far as I can tell, that should have worked. I see unraid uses PHP 7.4.15. My dev webserver is 7.4.25 so I don't image there would be an issue there. Any ideas?

You could try running the .page file from the Unraid console via the php -f option so it executes within an Unraid context in case the php conflicts with something that Unraid adds as standard to .page files

 

Also including a line reading 

error_reporting(E_ALL);		 // This option should only be enabled for testing purposes 

at the top of the file might provide additional information

  • Author

Thanks for the suggestions.  Running it with php spit out a bunch of html. I save it and loaded it in my browser just fine. However, the php code has some config options at the beginning. If I set  $use_auth to false, then I get an index error :
 

Notice: Undefined index: HTTP_HOST in /usr/local/emhttp/plugins/dynamix.system.autofan/FanSettings.page on line 66
<h1>Root path "" not found! </h1>

this is line 66

$root_path = $_SERVER['DOCUMENT_ROOT'];

I get another issue with $_SERVER if I fix that. It seems $_SERVER is not set. But I'm not sure why the php -f command works in the first place, until I change $use_auth. I don't work in php much. Regardless, the error in the unraid UI doesn't change.

Edited by bobbintb

 The .page files are not really designed to work outside the Unraid GUI unless special action is taken in the PHP code to support this which if probably why you got the errors you mentioned.  In particular the code to handle multi-language support can sometimes have unexpected side-effects.  I was hoping that you might get useful error messages to help with debugging.

  • Author
19 hours ago, itimpi said:

 The .page files are not really designed to work outside the Unraid GUI unless special action is taken in the PHP code to support this which if probably why you got the errors you mentioned.  In particular the code to handle multi-language support can sometimes have unexpected side-effects.  I was hoping that you might get useful error messages to help with debugging.

Understood. Well, I pretty much got the successful test I was looking for. I think the PHP I was using was just too complex and not meant for unraid, as you said. Thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.