rocket1356 Posted June 8, 2007 Share Posted June 8, 2007 Hi, 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? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/ Share on other sites More sharing options...
only one Posted June 8, 2007 Share Posted June 8, 2007 cant you just use the windows server to connect to the linux server by finding the path of the .ini file eg. $lines = file('path to php.ini'); foreach ($lines as $num => $line) { echo "Line-($num): $line<br />"; } or just use the include function Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270585 Share on other sites More sharing options...
only one Posted June 8, 2007 Share Posted June 8, 2007 soz i just realised you wanted to let it be editable... just use the fopen function <?php $file = 'path to php.ini' ; $content = file_get_contents($file); //edit some of this echo " <form action='file update.php'> <textarea name='new_content'>$content</texarea><br /> <input type='submit' value='submit' /> </form> "; ?> now you need to update the file contents to the textarea variable <?php $file = 'path to php.ini' ; fopen ($file); fwrite($file, $_POST[new_content]); fcolse($file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270588 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 The customer is running LINUX on a 512mb flash drive. I can only install very important files. Their LINUX box does not have any GUI just console. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270906 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 So I connect to the LINUX box through what command? Can I use ssh2? Do I have to install ssh library or some sort? Can I change their IP/Hostname by editing their config. files and then reboot? Also, the .ini I am talking about is some file that controls the PLC(Input/Output relays). Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270914 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 Sorry to ask you guys multiple questions. Do I need to install php on the windows machine and the LINUX box? Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270917 Share on other sites More sharing options...
AV1611 Posted June 8, 2007 Share Posted June 8, 2007 Can we start over? Is this correct? the customer has computer (SBC? EMBEDDED?) with Linux. The Device has an INI on it that has to be edited from time to time to make it do what the user wants. You need to let them edit the INI remotely. Correct so far? There are several solutions, but I'll wait for you to tell me if I got it right or if I'm totally lost on what you want. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270921 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 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. Can I also change the IP address(via the PHP script)? The customer might change their mind about the IP address they gave to us(but I do not think that this is a priority yet). Please let me know if this is not clear. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270940 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 I will need to give the customer the php website to add into their WINDOWS OS. Do they need to download WINDOWS php binaries from php.net? Do I have to add something like certain library to the LINUX OS for PHP-LINUX communication? Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270943 Share on other sites More sharing options...
AV1611 Posted June 8, 2007 Share Posted June 8, 2007 here is how I would do it: First, I'd add an ftp server to the linux box(s). 1. Pull the existing .ini from the linux box(s) as needed with php/ftp. 2. Edit the .ini file with php/html 3. Push the new .ini to the linux box with php/ftp should work slick and clean need more details? Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-270993 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 Sure I need more details. How big is the ftp server program. As the LINUX box can only handle a total of 512mb(flash drive). I think it has a ssh server/client program in there because I can manually use a SSH program to ssh into the LINUX box. Is there another solution if the ftp server program cannot be installed in the LINUX machine? Right now I am stuck on connecting to the LINUX machine. Another problem is: Do the customer need to install apache server and php on their WINDOWS machine to get the php website to start up? They are not hosting the website, they are just using the website to remotely connect into the LINUX machine. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271040 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 Do you need apache server to view a php website? I thought its for hosting only. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271076 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 Just talked to my co-worker. The apache cannot be install in the customer machine. So is the php solution a no go if Apache is needed? Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271100 Share on other sites More sharing options...
DyslexicDog Posted June 8, 2007 Share Posted June 8, 2007 Do you need apache server to view a php website? I thought its for hosting only. No you don't have to use apache but it's fairly easy to setup. IIS can also be configured to parse PHP scripts. You might want to look into one of the prebuilt configurations like WAMP or XAMPP. If your PHP server is going to be running on a windows based computer. If you have a developer that has already setup a mini Linux for these embedded systems they should be able to configure a Linux based server for you. EDIT: You could also use the command line interface in windows. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271116 Share on other sites More sharing options...
rocket1356 Posted June 8, 2007 Author Share Posted June 8, 2007 Damn, the customer IT department does not like the idea of having webserver on any of their windows machine. Is there any other solution other than me creating a VB or c++ program? Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271190 Share on other sites More sharing options...
AV1611 Posted June 10, 2007 Share Posted June 10, 2007 You can do this a ton of ways. You basically need to be able to talk to a linux box from a windows box. ssh can do that, but ftp is VERY SMALL footprint. I think FTP is still the way to go. You can run linux with LAMP & ftp, etc. with DSL Linux from a 256mb thumbdrive, so I think you should have no problem with FTP server. It is the least work to do exactly what you want. Quote Link to comment https://forums.phpfreaks.com/topic/54713-windows-php-connect-into-linux-server/#findComment-271623 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.