Web controlling using PHP and AJAX in Windows system
สิงหาคม 16, 2010 1 ความเห็น
Due several requests I have also made a Windows port of my Web controlling using PHP and AJAX system. That Windows version is based on the following components:
- PHP capable web server running on Windows system (I used PortableWebAp version 3.2)
- Windows version of my portcontrol sofware (portcontrol.exe)
- inpout32.dll driver needed by portcontrol.exe to be able to control hardware in Windows NT/2000/XP systems
- Slightly modified version of my “Web controlling using PHP and AJAX” PHP scripts. The modifications needed were mostly related to different executable portcontrol program (portcontrol vs. portcontrol.exe) name and different program path (In Windows version executable is in same directory as PHP code)
To use the package you need to do the following:
First you need to download PortableWebAp version 3.2 from http://www.epanorama.net/counter.php?url=http://portablewebap.com/. This is a free software package, although to get it you need to register first. PortableWebAp is a portable platform for web applications. With it you can run php web applications from a CDROM, DVD, USB Drive, from any directory from any hard drive. No installation is necessary. I selected this packege for the simplicity of installation: Just unzip the .zip file to directory you want and run it from there. No installation or configuration needed. Size is only around 5mb. Easiest to set up web server for Windows I have seen! For example install this software to directory C:\PortableWebAp3.2
NORE: The software is tested to work well on PortableWebAp version 3.2 (includes PHP4). The software packet does not seem to work with newer PortableWebAp version 4.
Then you need to download inpout32 driver from http://www.epanorama.net/counter.php?url=http://www.logix4u.net/inpout32.htm. Download the .zip file that contain the driver. Unzip the .zip file to suitable directory. Copy inpout32.dll to system directory where the system can find it. In my Windows 2000 system suitable directory was C:\WINNT\system32 directory (if you use different verwion of WIndows that can be different).
The third component you need are my PHP script and portcontrol.exe package. Download this WinPortControlAjax.zip package HERE. Just download the .zip file. Create a directory named portcontrol under directory C:\PortableWebAp3.2\Program\www\localhost. Now you unzip the package to this C:\PortableWebAp3.2\Program\www\localhost\portcontrol directory.
Now you have all the parts needed to set up the system. Next part is testing:
Start the PortableWebAp by running portablewebap.exe from C:\PortableWebAp3.2 directory. This will start the web server and also your web browser. If your computer has firewall software in it, your firewall software might ask if you want this program to be allowed to be run as a service/server (allow that). The browser initially points to URL http://localhost:800/ . Type in the address http://localhost:800/portcontrol/control.php to your web browser to go to port control application. You have now the same looking control screen as in Linux application above.
There is also a newer version of the example software for PortableWebAp version 4. Download the PortcontrolWebAp4.zip file. Just unzip file to Program\www\localhost\portcontrol subdirectory under the directory where you installed the PortcontrolWebAp4. Type in the address http://localhost:800/portcontrol/control.php to your web browser to go to port control application. This PortcontrolWebAp4.zip file is all you need in addition to PortableWebAp because this new packet includes all the needed files in it (PHP source,Sajax, portcontrol.exe and inpout32 driver).
This works pretty also on Windows system. There is one downside on the way this Windows system is implemented. You seen occasional screen flashing on the computer that run the server. This is caused by the portcontrol.exe starting every few seconds (started by control.php when web browser AJAX asks for status update). Every time portcontrol.exe is started, it’s console Window shows up (you see the console Window because portcontrol.exe is Windows console application), and closes just a fraction of second later.