php check for directory on users computer - php

Is it possible to check for a directory on a users computer without knowing the directory? I want to write a php program that allows me to look at my skype photos, but every computer has a different file directory, based on the account name on the computer. File Directory:
C:\Users\compUser\AppData\Roaming\skype\Pictures
I'm looking for a similar function where; if we were to make the run command on a windows pc, you can type %appdata%\skype\pictures and have the file directory pop up.

PHP is a server side language, it can only browse the files on it's own server.

You can't access to local user pc directory for security motivations, you can access only to server directory (where php run)

PHP is a server side language, it can only browse the files on it's own server.
and you cannot access any file from computer to php server without input

Related

php vs code project to aws apache server file permissions

I try to set up a server in AWS
I have 2 folders in the www Folder of the apace server.
www/userdata
www/WebContent
How do i have to set the file permissions for the WebContent folder.
I think when the server is serving the php page it doesn't allow the php page (php script) to fetch the data from the /userdata folder.
So the pages in the webcontent server are readable by everyone.
The /userdata folder is not readable by everyone.
The php page gets the date from the /userdata folder just when the /userdata folder is readble by everyone.
This is my fist time trying to set up a server without vs code.
How do i have to set the permissions or group or what ever to get this work.
Thanks for the answers.
benni
the solution was to set the document root of the apache server to /WebContent
now just the server side script can access the userdata because on the other hand only the document root can be accessed from outside. The date is not accessible from outside but the php page is.
Bye
Benni

Access remote Windows server FILES from Linux Apache Webserver via Browser Hyperlink

I have installed an apache webserver on Linux Debian and created an intranet on it. The intranet basically shows tables with entries from sql queries via php and mysql.
In one of these tables I would like to add a hyperlink that leads to/opens files and folders on a remote windows server.
I can access these files on the windows server from my linux webserver via cifs protocol.
How do I tell apache and/or linux where they need to go when a user clicks on a hyperlink in my intranet?
The path for the windows server is: \10.0.10.100\data\moredata\file.xls
I can access the windows server folders on my linux webserver via the following path: /media/data/moredata/file.xls
However, if I place this path inside html tag like this:
open my file please , it won't work.
If I try it like this: open my file please , it also won't work.
I believe that I need to insert the path inside apache.conf ? Is this correct? And if so, how is it done exactly?
You have to create Alias for that. Like 10.0.10.100/media can be pointing to your root /media folder. You can do it in your config file. Hope this link can help.

IIS does not allow run .exe file using excec command on PHP

I have a code on PHP that was working in a server but we migrate that code to another server and now that code is not working, specifically we want to run an .exe file using PHP with the instruction exec
I debug the script and it looks be working properly and the IUSR user and IIS_IUSR have the correct permissions and actually the exe file is running, but, when it run it need generate some files that is the part that cause the issues, the program are trying to create files on the AppPool directory for example like this:
C:\MyPath\somewebsite.com\8áª\MyProgram\
Where C:\MyPath\somewebsite.com\ is the AppPool root directory and MyProgram\ is the directory that the app is creating
Where \8᪠is generated randomly and changes all the time that we try to run the program, debugging with Process Monitor I can get an error: PATH NOT FOUND and/or NAME INVALID, on the previous server we modify the user on the IIS to run the script (that was on IIS 6 now we are on IIS 8.5) and that files was created on the home directory of the user AND without the random directory, for example:
C:\Users\MyUser\MyProgram\
where MyUser is the user that we assigned, but on that new server we get the files on the AppPool directory no matter if we change the user
I think that we can solve that if we was able to define a path for the IUSR user and set it as "home" path but I cannot found where to modify the IUSR user, I know that is a build-in user that IIS create but I'm not sure if I can edit that settings for that user.
I already mention that we used IIS but just as an extra data, we are running that over Windows Server 2012 R2
Any suggestion?
You topic / question is:
IIS does not allow run .exe file using excec command on PHP
which is the correct behavior! You don't want to run .exe files through PHP, really. You have to give the IUSR execute permissions on cmd.exe first, meany you might as well give all your virtual users administrator permissions.
lot of time after but, PHP side was ok, the problem was on the .exe file, the exe file create some files that was used for the same exe program, but it uses relative paths so when the process run makes that did not found the files generated and this caused the errors

PHP and NAS (IIS 7.5, Windows Server 2008)

how can i access folders like
\\10.200.0.3\some_folder
user name: user
password: pass
is it possible to map network device then access it using php?
please help me connect to this share and access files there..
Try one of these;
Make sure the IIS worker process has access to that location (IUSR or IIS_IUSRS)
Change the website's application settings in IIS to use credentials from a user account who has access to the location
Since you will be running PHP using IIS/Apache user make sure server user also has permissions to access network shared folder. Once you are sure IIS user does have permissions to access shared folder, you may try listing contents of shared folder by using path such as:
$target_path = '\\\\server\\images\\';
Have a look at this questions, might be helpful:
PHP: upload files to network shared folder
What you're looking for is Server Message Block (SMB) or the open source implementation SAMBA.
To use this in PHP, you could look at smbwebclient.
You might however simply add a drive map to the share on your Windows server, assign it a fixed letter (like Z:) or even simply access \\hostname\folder (escape the backslashes) and use the PHP built in directory commands to read and write the files from that drive. It'll be a helluvalot easier.

Permission Denied on move_uploaded_file to another server in IIS

I have a PHP web application running on IIS, which allows a user to upload a file from a simple html form. The uploaded file is then moved to a folder on another server. This is working correctly on Apache, but fails on IIS with the error:
function['move_uploaded_file']failed to open stream: Permission denied
in...
I've checked all the permissions on the directories. If I run a simple PHP script through the command line to copy a file from the server into the folder on the other server it works correctly, so I suspect the problem is with IIS.
if (move_uploaded_file($_FILES ["file"] ["tmp_name"], "\\\\000.00.0.00\\tia\\web\\upload\\" .$_FILES["file"]["name"])) {
This has been covered already here. Quoting the reason here:
You have mapped target directory to a share such as \server2\files. These mappings are only available to the current users (eg, the admin account), not to the IUSR account that your php is probably running as (assuming IIS). Solution, don't use mappings, instead use the full 'unc' path name, ie '\server\share\folder\file.ext', also remember that the IUSR account will need access to these shares/folders/files
From what I can see in your comment, you are using a \\ prefixed network share as the target for your move_uploaded_file() operation.
I'll bet a beer that PHP isn't allowed to access that share. Remember, PHP runs with IIS's permissions!
Try saving to a local, globally writable path first. If that works, you know you have to fix the share's permissions.

Categories