Connect Mac OS X to a Samba file server remotely via PHP
Ever had to connect a Mac web server to a Samba file share remotely via a PHP/HMTL form? No?! Really!? Are you sure?? Check again, I'll wait.
What's that you say!? The answer is still no!? Oh. Well.. OK.
Well anyways, I had to do this the other day and I'm going to write it down here so that I don't forget how I did it.
My work uses a little Mac web server to serve up a GitList installation (a listing of all our repos). Problem is, the Git repositories live on our LAN (Samba) file server. The Mac needs to talk to the LAN so that it can read the Git repositories and display them on the page via GitList. The Mac web server doesn't have any credentials of its own to supply to the Samba share, so, with this scipt, we ask the user for their credentials and then use those to connect to the Samba share.