As far as i know you cannot start external programs through php. In any event most servers that use php are linux based and wouldn't have notepad installed.
Why would you wnat to do this? Perhaps someone could provide an alternative solution.
What they wanted me to add to our intranet was the ability to execute local programs. So I thought I would start with notepad. Everyone here uses Windows XP and has notepad at c:\windows\notepad.exe. So I'm trying to find a way (routeen whatever) to being able to click on an image located on the webpage to start the application.
I don't think you can do this using php. It might be possible with ActiveX or Java. If it was possible because PHP executes on the server then you would probably be only able to start notepad on the server which would slow your server right down.
Well there you go. Just been looking through the php manual and you can use the exec function to execute an external program. Clearly I am stupid so don't listen to my advice!
But it will execute server side, as PHP is a server side program, this won't open the user's version of notepad, but will open it on the server side. He'll need to do it with Java or Active X.
A cheap way to force open an application client-side like Word is to make a link with mime-type that Word normally opens. Problem, I guess, is text files will be displayed on the browser automatically. If you can configure all your browsers not to open plain text files and force open Notepad, all you have to do is make a blank text file.
You'd also have to get through the browsers having to ask "Do you want to save this or open the file?"
If my boss asked me to do something like that, I'd have made my own browser for distribution at the office and make my links in a way the browser knows how to interpret like
I think the idea is more to open a program like notepad on the client side that opens a file that is server side. While not the most "secure" way of doing things of course he's trying to find a way around not using something like Microsoft Sharepoint.
If he's trying to open a server-side file in local notepad, if they have MSnetwork running on client machines and on the server (or server running Samba) then he could use the MIME format trick with a PHP supplied name...
First page has a form asking for the file name,
page 2 appends the network drive letter and provides a link,
clicking the link (with notepad opens a new notepad to the files specified).
The down side is that they have to be on the same internal network, the server has to be mapped to the same drive letter on all computers, and the text files would have to open in notepad on all machines.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.