Hello,
I have started working on O'reilly's "Web Database Applications with PHP and MYSQL". I'm trying to get a feel for what kind of capabilities the php language has but this book doesn't seem to loose focus of database applications and doesn't provide a clear idea of the big picture (at least so far).
These are the kind of things I hoped I would be able to do with php:
1) a file processing web application: user would upload a file, php would be used to read file and process it (convert line endings or replace all quotations with spaces for instance), and then save the resulting processed file on users local disk.
2) Will I be able to access the web server? I was hoping to create a web interface for vsftpd that would be used to edit the config file and maybe run/start/reload the dameon. Another idea was to create a web based monitor for network connections, or processor status- which means php would need to be able to read those files or maybe php has functions for these kind of things? So the real question is will I be able to interact with the server beyond my apache root folder?
Thanks to anyone who can give me a better idea of what kind of things I would be able to do with php.
My background consists mostly of visual basic with MS access, some .NET, C, good knowledge of linux, and just starting out with html.
3)
the big picture of php- capabilities
Moderator: General Moderators
-
cavemaneca
- Forum Commoner
- Posts: 59
- Joined: Sat Dec 13, 2008 2:16 am
Re: the big picture of php- capabilities
You should be able to do some of these kind of things. As far as I've seen, PHP is a simpler form of c++ made for web pages.
1) There are multiple websites online that do media conversions, then give you a link to download the converted file, if that is similar to what you mean. I'm not sure but some of these do use some php at least.
2) PHP has functions for reading both files and databases. By having a program that constantly updates a file or database, you could create a PHP script to read that.
1) There are multiple websites online that do media conversions, then give you a link to download the converted file, if that is similar to what you mean. I'm not sure but some of these do use some php at least.
2) PHP has functions for reading both files and databases. By having a program that constantly updates a file or database, you could create a PHP script to read that.
Re: the big picture of php- capabilities
Both of those are possible, but may require executing external (possibly custom) applications (which would mean you probably can't do this on an average web host). We can't tell you how to do all of those things, so if you want more details you should narrow your focus to one thing at a time.
Re: the big picture of php- capabilities
Thanks for the replies folks.
I did some googling and came across this php manual - http://us.php.net/manual/en/index.php where I found the functions fread, frwite, fopen and whole bunch of other filesystem functions. so I think I will be able to do the kinds of things I want to do.
I am having problems coping files from /proc, such as /proc/cpuinfo. the copied file is blank. I think it is due to the dynamic nature of these files since I guess they are constantly overwritten.
here is a script I made to view my vsftpd config file. I used it just to practice reading/writing/copying files. I'm betting there is a way to direct output so that it will prompt the user to save to local their local disk.
Later I want to turn it into a full blown interactive interface with drop down boxes for each of the parameters along with descriptions.
I did some googling and came across this php manual - http://us.php.net/manual/en/index.php where I found the functions fread, frwite, fopen and whole bunch of other filesystem functions. so I think I will be able to do the kinds of things I want to do.
I am having problems coping files from /proc, such as /proc/cpuinfo. the copied file is blank. I think it is due to the dynamic nature of these files since I guess they are constantly overwritten.
here is a script I made to view my vsftpd config file. I used it just to practice reading/writing/copying files. I'm betting there is a way to direct output so that it will prompt the user to save to local their local disk.
Later I want to turn it into a full blown interactive interface with drop down boxes for each of the parameters along with descriptions.
Code: Select all
<?php
$source = "/etc/vsftpd.conf";
$dest_copy = "/CooperNet/www/joepserver.com/htdocs/PHP/cpuinfo.dat";
$dest_write = "/CooperNet/www/joepserver.com/htdocs/PHP/cpu_write.dat";
// Copy the file to another location (just for the heck of it)
if(!copy($source , $dest_copy))
print "failed";
//set file pointers for input and output files
$handle_read = fopen($dest_copy, "r");
$handle_write= fopen($dest_write, "w");
$contents = fread($handle_read, filesize($dest_copy));
//format $display for html output
//$contents will be used to write the file to output file
$display = str_replace("\n", "<br>", $contents);
print $display;
fclose($handle_read);
fwrite($handle_write, $contents);
?>
fclose($handle_write);