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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-08-2007, 01:54 AM
|
#1
|
LQ Newbie
Registered: Jun 2007
Posts: 6
Rep:
|
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
|
|
|
06-09-2007, 10:32 AM
|
#2
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
06-09-2007, 02:27 PM
|
#3
|
Member
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511
Rep:
|
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.
|
|
|
06-09-2007, 03:00 PM
|
#4
|
LQ Newbie
Registered: Jun 2007
Posts: 6
Original Poster
Rep:
|
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.
|
|
|
06-13-2007, 11:27 PM
|
#5
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
06-14-2007, 07:22 AM
|
#6
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,430
|
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 05:20 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|