FAQ  •  Register  •  Login

Web UI in PHP - support thread

<<

jlcooke

Streaming enthusiast

Posts: 22

Joined: Wed May 30, 2012 7:46 pm

Post Tue May 07, 2013 12:44 pm

Re: Web UI in PHP (revised)

Howdy WebUI Team,

Can you take a peak at my issue on this thread [http://forum.serviio.org/viewtopic.php?f=5&t=6821&p=69075#p69075]

Basically, the webui doesn't seem to want to cross devices. Is this an issue in serviio or the WebUI?

Serviio WebUI 1.4beta running against serviio-1.2.1:
serviio-web-1.4beta.png
serviio-web-1.4beta.png (11.02 KiB) Viewed 25239 times


Actual file system:
var_ftp_pub.png
var_ftp_pub.png (35.09 KiB) Viewed 25239 times
<<

mpemberton5

DLNA master

Posts: 120

Joined: Sun Aug 28, 2011 9:01 pm

Location: North Carolina, USA

Post Tue May 07, 2013 1:28 pm

Re: Web UI in PHP (revised)

Hey jlcooke,

What type of partition are these mounts?
What PHP version are you running?
Have you tried changing some of the permissions? I've not tested it, but wondering if scandir() is tripping up there.

Screenshots are awesome and proves something is going on. Thanks for including them.
Mark
<<

jlcooke

Streaming enthusiast

Posts: 22

Joined: Wed May 30, 2012 7:46 pm

Post Tue May 07, 2013 1:45 pm

Re: Web UI in PHP (revised)

mpemberton5 wrote:Hey jlcooke,

What type of partition are these mounts?

They're SATA drives mounted as EXT-4 FS.

mpemberton5 wrote:What PHP version are you running?

PHP 5.4.9 (cli) (built: Nov 22 2012 10:03:10)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

mpemberton5 wrote:Have you tried changing some of the permissions? I've not tested it, but wondering if scandir() is tripping up there.

Permissions in the screenshots show 755 for all the top-level folders for the mount points. And inside it's just as permissive.

I tried doing this on my machine:
  Code:
echo '<?php print_r( scandir("/var/ftp/pub") );'|php

and got this:
  Code:
Array
(
    [0] => .
    [1] => ..
    [2] => Backup
    [3] => Mirrors
    [4] => Movies
    [5] => Music
    [6] => Pictures
    [7] => TV
    [8] => Upload
    [9] => sdb1
    [10] => sdc1
    [11] => sdd
)


mpemberton5 wrote:Screenshots are awesome and proves something is going on. Thanks for including them.

Mark

:) No problem at all. I try to be helpful, and it was just easier to show than to explain. :)
<<

mpemberton5

DLNA master

Posts: 120

Joined: Sun Aug 28, 2011 9:01 pm

Location: North Carolina, USA

Post Tue May 07, 2013 3:18 pm

Re: Web UI in PHP (revised)

Great info. So it looks like we should be able to eliminate the partition type and PHP version. Nice. One other thing, is your virtual directory in Apache set to follow symbolic links (FollowSymLinks)? This might be where our problem is.

The Folder Tree code that I use was from a third party and here's the code they use:
  Code:
if( file_exists($base.$dir.$file) && $file != '.' && $file != '..' && is_dir($base.$dir.$file)){
   if(check_for_subdirs($base.$dir.$file)==true){
      echo '<li><a href="#" class="collapsed" rel="'.$dir.$file.'/"></a><a href="'.$dir.$file.'/" class="folder">'.$file.'</a></li>';
   }else{
      echo '<li><a href="#" class="nosubs" rel="'.$dir.$file.'/"></a><a href="'.$dir.$file.'/" class="folder">'.$file.'</a></li>';
   }
}


Since the symbolic links aren't showing, it's not making it past the first if statement. So, run these two commands to see what responses we get:
  Code:
echo '<?php print_r( file_exists("/var/ftp/pub/Music") );'|php

  Code:
echo '<?php print_r( is_dir("/var/ftp/pub/Music") );'|php

One of those are probably failing. Also, try this to see what it gives:
  Code:
echo '<?php print_r( is_link("/var/ftp/pub/Music") );'|php
<<

jlcooke

Streaming enthusiast

Posts: 22

Joined: Wed May 30, 2012 7:46 pm

Post Tue May 07, 2013 4:30 pm

Re: Web UI in PHP (revised)

mpemberton5 wrote:Great info.
...
Since the symbolic links aren't showing, it's not making it past the first if statement. So, run these two commands to see what responses we get:
...
One of those are probably failing. Also, try this to see what it gives:
...


They all return "1".

  Code:
echo '<?php print_r(array( file_exists("/var/ftp/pub/Music"), is_dir("/var/ftp/pub/Music"), is_link("/var/ftp/pub/Music"), ));'|php
Array
(
    [0] => 1
    [1] => 1
    [2] => 1
)


But from apache (http://myhost/mypath/testing.php) I get this:
  Code:
Array
(
    [0] =>
    [1] =>
    [2] => 1
)


Now it gets weird... I tried adding:
  Code:
<Directory /var/ftp/pub>
    Options FollowSymLinks
    AllowOverride None
</Directory>

Then did a graceful restart. No change. Did a hard restart, no change. Changed path to /var/ftp/pub/Music and no change.

Did a few other things in apache conf - I don't recall what - then it returns 1,1,1 and serviio-webui works.

I back out all my changes (in VIM did a 99 'u') and saved, existed, hard restart. The problem doesn't come back.

I am full confused now. Only possible explanation is I had updated the mod_php days (weeks?) ago and it didn't take until a hard restart ... donno.

Thanks for the help!
<<

mpemberton5

DLNA master

Posts: 120

Joined: Sun Aug 28, 2011 9:01 pm

Location: North Carolina, USA

Post Tue May 07, 2013 5:48 pm

Re: Web UI in PHP (revised)

I've seen enough "unexplainable" issues that it's now the norm. :)

Glad it's working now.

Cheers!
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Wed May 08, 2013 10:18 am

Re: Web UI in PHP (revised)

Swoop wrote:Can you elaborate further on the bug you've described? Are the sources addedd automatically as RSS and you later need to edit it accordingly? Is maybe a category parameter somewhere to be found?

When "Web Resource" items are added from ServiiDB, WebUI add it but the ResourceType as "RSS Feed" not "Web Resource"
Currently i have to edit it to "Web Resource" and save.

ServiiDB is getting bigger and bigger, easy to add items for custom Serviio plugins
Last edited by Xmantium on Wed May 08, 2013 11:42 am, edited 1 time in total.
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

Swoop

Serviio lover

Posts: 87

Joined: Fri Mar 29, 2013 10:21 am

Post Wed May 08, 2013 11:19 am

Re: Web UI in PHP (revised)

Ah, ok. Got it.

Tried something. Anyone wants to check?

https://github.com/SwoopX/Web-UI-for-Serviio.git
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Wed May 08, 2013 11:41 am

Re: Web UI in PHP (revised)

Swoop wrote:Tried something. Anyone wants to check?

Add as "Live Stream" instead of "Web Resource"
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

Swoop

Serviio lover

Posts: 87

Joined: Fri Mar 29, 2013 10:21 am

Post Wed May 08, 2013 11:57 am

Re: Web UI in PHP (revised)

Thanks for checking. Have to admit it was a quick shot.

At least I'm on the right path, it seems. I'll have a deeper look...

*EDIT* Stupid me. Swapped the values of the variables accidentially... Wanna try again?
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Wed May 08, 2013 12:22 pm

Re: Web UI in PHP (revised)

Success! Thanks Swoop!
Since theres no iOS app for iPad, this is my most used Web app.
Would be cool if Up/Down buttons can be added to Online Library.

Probably a question for Mark: How often does these fixes merge to Marks Official build?
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

Swoop

Serviio lover

Posts: 87

Joined: Fri Mar 29, 2013 10:21 am

Post Wed May 08, 2013 12:45 pm

Re: Web UI in PHP (revised)

Awesome, glad to hear ;)

Since I'm no web programmer (and especially a noob with jquery), changes to ServiiDB might take a little while from my side... But as I prefer havin things I use my self working correctly (fun and learning is also given here), I'm happy to support and maintain.

Haven't issued a pull request to Mark with the latest changes as I'm pretty sure there's still something :D Maybe Mark is willing to add a link of my "dev repo" @Git to the Wiki page, so that the latest can be downloaded before merged into the official build.
<<

npuser

DLNA master

Posts: 172

Joined: Mon Feb 06, 2012 3:44 am

Location: Michigan

Post Sat May 18, 2013 5:51 pm

Re: Web UI in PHP (revised)

Show Logs in Console (only useful for headless or NAS Serviio servers) - Others please do not attempt.

Please make a backup of files you need to modify.

If you are like me, running serviio in an ubuntu headless or in a NAS, and constantly using IOS Devices or ServiioWeb to manage the serviio, also frequently having to use ssh
or WinSCP to review the serviio log, then this post might just for you. This adds serviio Log tab to ServiioWeb and displays current logs once clicked.

1. ServiioWeb/config.php add following to line 12 and modify log folder location as necessary.
  Code:
$log = "/usr/share/serviio/log/serviio.log";

2. ServiioWeb/content.php - replace line 9 with following:
  Code:
if ($tab!="library" && $tab!="metadata" && $tab!="delivery" && $tab!="about" && $tab!="presentation" && $tab!="remote" && $tab!="settings" && $tab!="about" && $tab!="log") {

3. ServiioWeb/index.php - add following line to index.php at line 359
  Code:
<li><a href="content.php?tab=log" rel="indexcontainer"><?php echo tr('tab_log','Log')?></a></li>

4. save following code as log.php in ServiioWeb/view folder.
  Code:
<html>

<head>
<title>Show Serviio Log</title>
</head>
<body>
<?php
include("../config.php");
$file = fopen( $log, "r") or exit('<strong><span style="color:#FF0000;text-align:left;"> Unable to open Serviio log file! </span></strong>');
//Output a line of the file until the end is reached
while(!feof($file))
  {
  echo fgets($file). "<br>";
  }
fclose($file);
?>

</body>
</html>


NPuser
Attachments
Capture.JPG
Capture.JPG (110.15 KiB) Viewed 25133 times
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Sat May 18, 2013 9:24 pm

Re: Web UI in PHP (revised)

Wow this is cool, finally no more WinSCP to see what's going on my QNAP Server.

Does it auto refresh?
Would be even cooler it can be formatted, ie view only errors, view my date
About tab should be at the end.
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

darkcloud784

Streaming enthusiast

Posts: 23

Joined: Sun Dec 23, 2012 5:36 pm

Post Sun May 19, 2013 5:40 pm

Re: Web UI in PHP (revised)

I've been having some issues installing this, here is the area (as seen from the web browser). I am attempting to install the latest version listed on the wiki (1.4beta)

  Code:
The website encountered an error while retrieving http://192.168.1.17/serviio/. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.


My apache.conf:

  Code:
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned. 
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "foo.log"
# with ServerRoot set to "/etc/apache2" will be interpreted by the
# server as "/etc/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
LockFile ${APACHE_LOCK_DIR}/accept.lock

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested  instead of forcing the browser to accept
# incorrect  metadata.
#
DefaultType None


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue May 21, 2013 10:23 pm

Re: Web UI in PHP (revised)

<<

mpemberton5

DLNA master

Posts: 120

Joined: Sun Aug 28, 2011 9:01 pm

Location: North Carolina, USA

Post Wed May 22, 2013 6:26 pm

Re: Web UI in PHP (revised)

darkcloud784 wrote:I've been having some issues installing this, here is the area (as seen from the web browser). I am attempting to install the latest version listed on the wiki (1.4beta)


Can you confirm you have curl installed? Is there any entries in the Apache error log?
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Wed May 22, 2013 10:01 pm

Re: Web UI in PHP (revised)

@Mark - Definitely think having logs is a brilliant idea, excellent suggestion by npuser for the mod, works great

Im sure you may have some other brilliant ideas to display it on the webui
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

darkcloud784

Streaming enthusiast

Posts: 23

Joined: Sun Dec 23, 2012 5:36 pm

Post Fri May 24, 2013 1:39 am

Re: Web UI in PHP (revised)

mpemberton5 wrote:
darkcloud784 wrote:I've been having some issues installing this, here is the area (as seen from the web browser). I am attempting to install the latest version listed on the wiki (1.4beta)


Can you confirm you have curl installed? Is there any entries in the Apache error log?



What shows in the error log is
  Code:
 [Thu May 23 20:36:46 2013] [error] [client 192.168.1.136] PHP Fatal error:  Call to undefined function curl_init() in /var/www/serviio/lib/RestRequest.inc.php on line 57
[Thu May 23 20:36:47 2013] [error] [client 192.168.1.136] File does not exist: /var/www/favicon.ico



I can confirm curl is installed

apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.


-edit-

i've also tried re-installing curl which yielded no change.


-edit edit-

Figured it out... apparently I didn't have the php5 curl extension installed.... sorry to have wasted your time in reading my issue XD
<<

mpemberton5

DLNA master

Posts: 120

Joined: Sun Aug 28, 2011 9:01 pm

Location: North Carolina, USA

Post Fri May 24, 2013 2:21 am

Re: Web UI in PHP (revised)

darkcloud784 wrote:Figured it out... apparently I didn't have the php5 curl extension installed.... sorry to have wasted your time in reading my issue XD

Can't get it to work - headache
Posting for help - waiting patiently
Getting it to work - priceless

It's all good. Glad you got it working.
PreviousNext

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.