-   Linux - Newbie (
-   -   Windows PHP connect into LINUX server (

rocket1356 06-08-2007 01:54 AM

Windows PHP connect into LINUX server

I want to built a windows php website---> connect to the linux box--->read all settings value from the .ini files->display it into the php website->user can then change the values->save the .ini file base on the user modification close the file-->for back up reason of settings, also save the values into SQL database. I also need to reboot the linux box after apply changes to the .ini.

Anyone knows how to approach this problem? What do I need? Does php have a built in ssh?


MasterC 06-09-2007 10:32 AM

I am confused...

You want to build a website using PHP and host it up on a Linux system? If that is correct, then you have a few options:

By writing a page to just display the php info you can view the settings:


However, this doesn't allow for direct modification of the ini file. You would need to open the php.ini file and make the changes, and then save the file. You could do this over FTP or using SSH and a command line text editor such as pico, vim, nano or something similar.

Saving to the database doesn't make a whole lot of sense as the php.ini is a flat file, not a db type. I suppose you could set something up to read the php.ini as a string into a table, but that would be... strange. You could instead setup some sort of auto script (maybe using rsync) to download the php.ini at regular intervals to a local system for backup purposes.

And you shouldn't have to reboot the box after making changes, simply restarting the web server (apache probably) should suffice. How that is done depends on your distro, but may be something like:
/etc/init.d/apache2 restart


Tux-Slack 06-09-2007 02:27 PM

I think he wants a Web on a Linux machine using php to change php.ini file on the Linux machine while browsing the web from a windows machine.
Kinda pointless.
First, for changes to take effect you don't have to reboot. You can just restart the web server(apache or whatsoever). And second. Why bother reinventing the wheel with a PHP script if you can use a cost-free SSH client like PuTTY use a comand line text editor, vi, vim, pico, nano, whatever to change the ini file and restart the web server.

rocket1356 06-09-2007 03:00 PM

We have an in-house LINUX OS which our developer created. This LINUX is running on a 512mb flash. This LINUX will have serial card(with cables) controlling a motherboard full of relays(Infoo is not important, but just to let you know what it does). Because the serial card has settings, we created .ini files to configure the serial cards. When we ship out the LINUX box with our LINUX OS, we preconfigure the IP address that the customer gives to us.

OK, I hope it is cleared up to now. Now the customer has the LINUX box. They will boot up the machine. This machine will be online. They will now need to modify the .ini files to match the speed of communication they desired. Because they have multiple machines, it would be a hassle for them to modify each one after booting up.

So my idea is to create an installation script(PHP website), in a WINDOWS environment, that will interface with the LINUX box to change the settings in the .ini files. This script will ask how many LINUX box they have. It will need to connect into each one(can you connect into more than 1 LINUX machine with the PHP script?), reads the current .ini info in the LINUX box, then display it into the PHP website. The user can then edit the fields in the PHP website. They can hit 'Apply' and this will apply the settings to the LINUX box. I will then need to reboot the LINUX machine(via the PHP website), to get the changes.

I have to obviously install php binaries on the WINDOWS machine. Do I have to install APACHE or webserver too? All I want is for one user from one WINDOWS machine connecting into multiple LINUX machines. The one WINDOWS machine will just read/write files from the LINUX machine remotely. I think APACHE or other webserver is for hosting only. Since no other WINDOWS machine will use this website, so I don't need a webserver?. Or do I need just to use the php script. I do not want to install anything on the LINUX machine. Each LINUX machine has the "sshd" capability.


MasterC 06-13-2007 11:27 PM

You appear to making it more confusing than is necessary. You could easily just setup something like Samba to each machine and allow modifying the php.ini file directly from each machine (uniquely named and available in My Network Places) taking out the web interface completely. If you "must have" a web interface, you still don't necessarily need to do anything extremely exotic. You could run the webserver on each system you ship out, allow the webserver access to the php.ini file directly (through a simple file manager type setup) and then the most difficult part would be saving the file back to the server, but that wouldn't be too hard and you could probably even do this using simple PUT statements.

There is no need to wrap around the idea of communicating with a specific OS unless you AREN'T going to be using the web interface. With the web interface, you could be modifying those files using an Amiga and it wouldn't make a difference. The point that you are adamant about the recipient using WINDOWS to make the modifications means that it would be easiest to simply set it up to work with a Samba environment which would make it pretty seamless to them.


chrism01 06-14-2007 07:22 AM

If I understand the OP's latest explanation, the '.ini' files are for use with the driving the serial cards on the target Linux boxes; ie they are not php.ini files.
I think he wants a user-friendly eg PHP web page interface for the user to be able to set file contents, without having to directly edit the '.ini' files .
He wants the user to be able to use an MSWIN box to do this, so he's thinking of Apache+php to give a nice GUI interface ...

All times are GMT -5. The time now is 11:24 AM.