LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-08-2007, 01:54 AM   #1
rocket1356
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Rep: Reputation: 0
Windows PHP connect into LINUX server


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
 
Old 06-09-2007, 10:32 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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:
Code:
<?php
phpinfo();
?>
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

Cool
 
Old 06-09-2007, 02:27 PM   #3
Tux-Slack
Member
 
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511

Rep: Reputation: 37
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.
 
Old 06-09-2007, 03:00 PM   #4
rocket1356
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Original Poster
Rep: Reputation: 0
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.

Thanks.
 
Old 06-13-2007, 11:27 PM   #5
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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.

Cool
 
Old 06-14-2007, 07:22 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,430

Rep: Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788
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 ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect Linux Live CD to Windows 2000 Server vidgamer2000 Linux - Networking 1 02-24-2007 01:38 PM
how can Linux connect to windows vpn server LinuxLover Linux - Networking 1 10-01-2005 06:03 AM
windows xp cannot connect to linux server on start up robertngo Linux - Networking 2 06-08-2005 05:05 AM
linux 8 server but windows couldn't connect to WWW through router sheng8 Linux - Networking 2 08-17-2004 01:00 PM
windows client, linux nfs server how to connect feetyouwell Linux - Software 1 06-09-2004 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration