You might think it interesting, unusual, fun, strange ... whatever. I'm not worried about how brilliant it is, for that matter. What I'm interested in ... PHP is generally seen as a tool for the development of websites/pages, etc. It's more than that. What else have you done with PHP (that we don't need security clearance for)?
For example ... until a couple years ago, I used PHP to rotate my email .sig periodically.
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
I have used PHP many times for the same sort of things you might use shell scripts: parse web logs, assorted host maintenance tasks (often via cron), and so forth. Currently I'm working on a script to SFTP web log files from the production web servers to another location to ensure we have backups (in support of billing data).
Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett
"But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because he’s a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html
Indeed ... server admin. I use it for backups, for example.
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
Builds my sitemaps, runs back up, any task that I can automate in anyway basically. I use it to keep external harddrives sync'd. Basically anything i thought I could solve with programming, I've solved with PHP, mainly because until recently it was the only language I knew at all, and you can do so many things with it so easily, its hard to choose something in its place for me. Its installed on all my computers, as I write quick scripts here and there all the time.
Notably, I've used it to clean up and import data at work, even though I work in a .NET house. This annoys a couple of my coworkers (they think I should use ONLY .NET for everything) however, why not? If I can solve a problem in 30 minutes using PHP why wouldn't I use it?!?
Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail I'd rather be a comma, then a full stop. User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning
I use PHP for every program I need to write on a server or to automate my Ubuntu workstation. My two favorite "unusual" PHP projects are
* A multithreaded image fetching daemon process type thing which runs on a rackspace Cloud Server for one client. I haven't attempted multithreaded code since college and it was a real mind-bender to write it. It works pretty darn well -- although occasionally some of the forked processes get orphaned somehow and I'm not sure what causes it. The basic idea is that the website imports gobs of data every night from a bunch of partner website's data feeds. There are perhaps 100-200,000 images associated with this data that must be downloaded and thumbnailed and then loaded into the rackspace CDN. As you can imagine, having one machine run a single PHP script that sequentially processes each image would take an exorbitant amount of time (assuming 2 seconds per image, it would take 2-4 days to process these). Additionally, the machine would be most idle waiting for the images to download. Multithreading provided maximum utilization of a single compute instance and we took special care to allow many of the image fetching machines to run at once.
* FlashMOG (see signature) which I have neglected for some time. It's a lot like AMFPHP but uses sockets instead and therefore permits two-way communication without polling. I'm thinking about adapting it to html5's websockets. I'm also trying to find time to fix AMFEXT which would provide some really fast AMF3 serialization. Emanuelle Ruffaldi has passed it on to me so I'm the package maintainer, I just can't find any time. The guys at AMFPHP seem really interested.
Sneakyimp, your FlashMOG project sounds more than interesting ... but the linked page is currently 500. (Maybe you're working on it now?)
Originally Posted by Derokorian
Builds my sitemaps,
It is handy for that ... I do that as well. When I owned my own shop it was my ticketing and accounting software as well, but it was web-based ... so I don't know if that counts in this discussion. It was kind of interesting writing the ticket printing code with it.
I also have lots of CLI utilities that I've written in PHP. For managing spam controls and firewalls, etc.
The project I'm on now is fairly interesting, too; at least for me. It's got some "AI" angles to it, and will ultimately be a replacement for a job my boss has to do manually at present. It's been kind of interesting figuring out how to make PHP think like he does
Basically anything i thought I could solve with programming, I've solved with PHP, mainly because until recently it was the only language I knew at all, and you can do so many things with it so easily, its hard to choose something in its place for me.
I've attempted to branch out a bit myself. I have a few server utiilties now in Python, one tiny C program, and last fall I wrote a one-page accounting app for garage sales in JS.
Last edited by dalecosp; 01-16-2013 at 10:20 PM.
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
Sneakyimp, your FlashMOG project sounds more than interesting ... but the linked page is currently 500. (Maybe you're working on it now?)
Drat! I wrote a custom bit of code to implement a hierarchical documentation structure thing and part of it was linked to phpBB (I wanted to allow comments on the docs like they do at php.net). I recently upgraded phpBB so I probably broke something. Thanks for the heads up.
At any rate, thanks for the props. I'm thinking FlashMOG could also use some multithreaded magic. The motivation for taking over AMFEXT was to speed up the serialization and deserialization of remote procedure calls. That is currently the bottleneck.
Originally Posted by dalecosp
and last fall I wrote a one-page accounting app for garage sales in JS.
Ooh...I almost forgot: several years ago I found a PHP module that allowed communication with the serial port (Windows only, I think). I put together a localhost page on my laptop that allowed me to control my A/V receiver through it's serial port. It was a geeky kludge that got me by for awhile after the receiver's remote control died, until I found a compatible replacement.
Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett
"But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because he’s a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html
I've also considered looking into writing some basic, general libraries to implement genetic algorithms and neural networks. I've never gotten around to reading enough about them to generalize the concept and provide an interface. Both might be really helpful for preventing spam or recognizing bots or something.
A more recent need, given the failure of this other post, is a load testing script. It would be nice to have a script that could take a list of urls, some cookie and/or session settings, some specifications about how many threads to run how frequently and how long, and then it would run a stress test on a web server. Bonus points for coordinating multiple machines in a single stress test.
Ooh...I almost forgot: several years ago I found a PHP module that allowed communication with the serial port (Windows only, I think). I put together a localhost page on my laptop that allowed me to control my A/V receiver through it's serial port. It was a geeky kludge that got me by for awhile after the receiver's remote control died, until I found a compatible replacement.
That's geeky, and I love the story.
I guess I've become a full-fledged geek now
Originally Posted by sneakyimp
I've also considered looking into writing some basic, general libraries to implement genetic algorithms and neural networks. I've never gotten around to reading enough about them to generalize the concept and provide an interface. Both might be really helpful for preventing spam or recognizing bots or something.
Sounds interesting. Do you think we'll still be using PHP when "wetware interfacing" is common? (Incidentally, I hope to be living on a remote mountain or underground by then ).
Originally Posted by sneakyimp
A more recent need, given the failure of this other post, is a load testing script. It would be nice to have a script that could take a list of urls, some cookie and/or session settings, some specifications about how many threads to run how frequently and how long, and then it would run a stress test on a web server. Bonus points for coordinating multiple machines in a single stress test.
Sounds nice, although I think I'm afraid of what it might show me. I'm running into issues of scale quite frequently these days when I get past the initial phase of development...
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
While I program in Python far, far more than in PHP these days... if I want to do a "rotate 13" on a string, I fire up my PHP script that calls str_rot13, instead of doing it in Python.
if I want to do a "rotate 13" on a string, I fire up my PHP script that calls str_rot13, instead of doing it in Python.
Any particular reason why?
Code:
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> "foobar".encode("rot13")
'sbbone'
Bookmarks