"Different" uses of PHP ...
Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: "Different" uses of PHP ...

  1. #1
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,726

    "Different" uses of PHP ...

    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

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,986
    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


    eBookworm.us

  3. #3
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,726
    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

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  4. #4
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,792
    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

  5. #5
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,932
    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.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  6. #6
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,726
    Sneakyimp, your FlashMOG project sounds more than interesting ... but the linked page is currently 500. (Maybe you're working on it now?)

    Quote 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 11: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

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  7. #7
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    I use it all the time for various cron jobs, as well as semi-customized emailings.

    Quote Originally Posted by dalecosp View Post
    Sneakyimp, your FlashMOG project sounds more than interesting ...
    Agreed (try just http://flashmog.net).

  8. #8
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,932
    Quote Originally Posted by dalecosp View Post
    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.

    Quote Originally Posted by dalecosp View Post
    and last fall I wrote a one-page accounting app for garage sales in JS.
    If you are at all interested in JS, you *must* check out phonegap:
    http://phonegap.com/developer/
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  9. #9
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    13,986
    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


    eBookworm.us

  10. #10
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,932
    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.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  11. #11
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,932
    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.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  12. #12
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,726
    Quote Originally Posted by NogDog View Post
    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

    Quote Originally Posted by sneakyimp View Post
    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 ).

    Quote Originally Posted by sneakyimp View Post
    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

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  13. #13
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,593
    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.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  14. #14
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Quote Originally Posted by laserlight View Post
    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'

  15. #15
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,593
    I happen to have the script readily available from years ago, and it works!

    Not that I use it often though, but you know, spoilers and such.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •