PHP Code to login to NAS

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
zy682517
New here
Posts: 5
Joined: Thu Jan 16, 2020 1:30 am
Contact:

PHP Code to login to NAS

Post by zy682517 »

Hi,
I've posted before looking for direction on scanning Directories using PHP - still trying to get the following code to work:-

<?php
$dir = "//192.168.0.25:80/Films/A";
// Sort in ascending order - this is default
$a = scandir($dir);
var_dump($dir);
var_dump($a);
// Sort in descending order
$b = scandir($dir,1);
print_r($a);
print_r($b);
?>


I have successfully written PHP to connect to the MySQL installation on my TS-251+ and everything works as intended. I've also made sure guest user has read access which I reckon was needed to scan directories.
Other helpful posts (dolbyman especially) are leading me to think I need to be authenticated first before I can see directories and files as per the above code.

What does everyone think?

Robert, Edinburgh
Robert, Edinburgh
User avatar
Toxic17
Ask me anything
Posts: 6476
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: PHP Code to login to NAS

Post by Toxic17 »

just wondering does the guest account need write access if any output is written to temporary disk space perhaps or is everything written to ram?
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
User avatar
Toxic17
Ask me anything
Posts: 6476
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: PHP Code to login to NAS

Post by Toxic17 »

can you confirm the //192.168.0.25:80/Films/A" is in the /share/web/ folder.

perhaps use

//share/web/Films/A";

also the builtin web server on QNAP has an apache owner of httpdusr[99] as far as I know. I have seen in the past with wordpress etc the subfolders may need ownership by the apache user (if this is a web application that is calling the command)
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”