0

I have the following php command:

  1. $shellOutput = shell_exec('net use');

I receive the following output:

Status  Local   Remote      Network

OK            S:    \\srv\dataS     Microsoft Windows Network

When I run net use in a cmd window I receive the following output

 Status Local   Remote      Network

 OK           L:    \\srv\dataL Microsoft Windows Network
 OK           M:    \\srv\dataM Microsoft Windows Network
 OK           P:    \\srv\dataP Microsoft Windows Network
 OK           R:    \\srv\dataR Microsoft Windows Network
 OK           S:    \\srv\dataS Microsoft Windows Network

Should all the mapped network drives display or does PHP limit the number of drives returned?

If the command supposed to return more than 1 network drive, please provide short example on who to get more than one row to return.

TIA


After performing the var_dump, the value returned was

Status  Local   Remote      Network

OK      S:      \\srv\dataS     Microsoft Windows Network
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
Anthony S
  • 65
  • 11

1 Answers1

0

shell_execute should return the complete output as a string, please make sure, you are not using exec.

  1. Make sure, the user who is running the code (apache, www-data, httpd,etc) has the right permission for connecting all the network drivers.
  2. Can you please,let me know what are you trying to achieve?

Unfortunately, I do not have a Windows environment, and I can not test Windows commands. However; Linux commands work as expected with shell_exec (output as a string)

Please let me know

Leandro Papasidero
  • 3,728
  • 1
  • 18
  • 33
  • I am trying to pass a fully quailified file name (server/directory(ies)/filename and extension. The file will eventually be read into a database using BCP and further processed once on the dataabse. – Anthony S Aug 29 '14 at 12:26
  • Sorry forgot to mention that when I upload the data into the database, the table names are different based up the user who uploads the data. At the time the files are selected I do not have the information on the user who selected the files. – Anthony S Aug 29 '14 at 13:14