PHP Portability Tip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Google Mike

    PHP Portability Tip

    No, this isn't what you thought the subject of this post meant. It's
    better.

    I just wanted to share with you something I did that makes editing PHP
    and carrying your projects back and forth a little easier. (That's
    what I mean by portability in this case.)

    I often go between my day job and my home, carrying code. I used to
    either email it to myself and pick it up, or FTP it to my website, or
    risk everything and put it on a floppy. (Most often the floppy would
    fail.)

    Then came along this USB Memory Key thing. I picked up one from Dell
    that I thought was really durable and affordable. Try $35 for 128MB
    (Oct 2003 price). So I started putting my PHP code there.

    Then it dawned on me. Why don't I use my Linux and Apache to
    automatically mount my web directory with the latest project directory
    when I insert my USB Memory Key in? That way, I don't have to copy
    files around because I'm always editing them on the USB Memory Key. I
    found that this was sufficiently fast, and you probably will to.

    So, how does that work, exactly?

    I'd rather answer your questions about it specifically than take the
    time to spell it all out, dumping Bash code scripts and so on, but
    it's really relatively simple. You can probably take the concepts here
    and do the same thing on Windows with Apache or IIS.

    The way I do this is to first do the steps to mount my USB Memory Key
    in Linux. It shows up on my system as /dev/sda1 and I mount to
    "/mnt/thumb" (thumb drive). If you do a search on Google Groups for
    "googlemike usb", you'll find out this is done, but I found it can
    involve "sudo" and "sudoers", as you'll see in that post.

    Next, I made an icon on my desktop that I double-click. It's linked to
    a Bash script. It asks if I want to mount or unmount the memory key.

    Next, I made a soft link (Windows users can make a shortcut) from
    inside my Apache's web directory at /var/www/html to point to
    /mnt/thumb/projects/php/. Now when I point my web browser or IDE
    there, it shows up.

    There's a catch. The files must be edited as root, evidently, so I
    have to make my PHP IDE -- Quanta -- load as root and edit the files
    at /mnt/thumb/projects/php. The way I do that is with "sudo" and
    "sudoers". My GNOME desktop icon for Quanta does:

    sudo -u root /usr/bin/quanta

    Now I can move quicker between office and home, carrying my latest PHP
    code with me, and I don't have to use any file manager or type any
    commands.

    If you want more detail, ask me what you will and I'll try to help
    you.
  • Michael Willcocks

    #2
    Re: PHP Portability Tip

    Sound great in theory
    But is this key thing a battery operated device?

    I like the idea of it. I have an old Nokia 5510 or something at home which
    had an MP3 Player on it but when I connect it to my windows 2000 machine it
    just mounts as an removable storage device.

    Good idea!


    "Google Mike" <googlemike@hot pop.com> wrote in message
    news:25d8d6a8.0 310122038.92507 0d@posting.goog le.com...[color=blue]
    > No, this isn't what you thought the subject of this post meant. It's
    > better.
    >
    > I just wanted to share with you something I did that makes editing PHP
    > and carrying your projects back and forth a little easier. (That's
    > what I mean by portability in this case.)
    >
    > I often go between my day job and my home, carrying code. I used to
    > either email it to myself and pick it up, or FTP it to my website, or
    > risk everything and put it on a floppy. (Most often the floppy would
    > fail.)
    >
    > Then came along this USB Memory Key thing. I picked up one from Dell
    > that I thought was really durable and affordable. Try $35 for 128MB
    > (Oct 2003 price). So I started putting my PHP code there.
    >
    > Then it dawned on me. Why don't I use my Linux and Apache to
    > automatically mount my web directory with the latest project directory
    > when I insert my USB Memory Key in? That way, I don't have to copy
    > files around because I'm always editing them on the USB Memory Key. I
    > found that this was sufficiently fast, and you probably will to.
    >
    > So, how does that work, exactly?
    >
    > I'd rather answer your questions about it specifically than take the
    > time to spell it all out, dumping Bash code scripts and so on, but
    > it's really relatively simple. You can probably take the concepts here
    > and do the same thing on Windows with Apache or IIS.
    >
    > The way I do this is to first do the steps to mount my USB Memory Key
    > in Linux. It shows up on my system as /dev/sda1 and I mount to
    > "/mnt/thumb" (thumb drive). If you do a search on Google Groups for
    > "googlemike usb", you'll find out this is done, but I found it can
    > involve "sudo" and "sudoers", as you'll see in that post.
    >
    > Next, I made an icon on my desktop that I double-click. It's linked to
    > a Bash script. It asks if I want to mount or unmount the memory key.
    >
    > Next, I made a soft link (Windows users can make a shortcut) from
    > inside my Apache's web directory at /var/www/html to point to
    > /mnt/thumb/projects/php/. Now when I point my web browser or IDE
    > there, it shows up.
    >
    > There's a catch. The files must be edited as root, evidently, so I
    > have to make my PHP IDE -- Quanta -- load as root and edit the files
    > at /mnt/thumb/projects/php. The way I do that is with "sudo" and
    > "sudoers". My GNOME desktop icon for Quanta does:
    >
    > sudo -u root /usr/bin/quanta
    >
    > Now I can move quicker between office and home, carrying my latest PHP
    > code with me, and I don't have to use any file manager or type any
    > commands.
    >
    > If you want more detail, ask me what you will and I'll try to help
    > you.[/color]


    Comment

    • luc wastiaux

      #3
      Re: PHP Portability Tip

      Google Mike wrote:
      [color=blue]
      > There's a catch. The files must be edited as root, evidently, so I
      > have to make my PHP IDE -- Quanta -- load as root and edit the files
      > at /mnt/thumb/projects/php. The way I do that is with "sudo" and
      > "sudoers". My GNOME desktop icon for Quanta does:
      >
      > sudo -u root /usr/bin/quanta[/color]

      A better idea would be to give your user write permissions on the drive,
      which involves chown you.yougroup /mnt/thumb , then see the manual
      for 'mount' to mount the drive as to give you write access.

      --
      luc wastiaux - email: dustpuppy@airpo st.net
      jabber: luc@jabber.4002 .org
      ICQ: 76235870

      Comment

      • Google Mike

        #4
        Re: PHP Portability Tip

        "Michael Willcocks" <michael@metrog roup.com.au> wrote...[color=blue]
        > But is this key thing a battery operated device?
        >
        > I like the idea of it. I have an old Nokia 5510 or something at home which
        > had an MP3 Player on it but when I connect it to my windows 2000 machine it
        > just mounts as an removable storage device.[/color]

        Not a battery operated device. The things are called "pen drives",
        "thumb drives", "usb memory keys" (on Dell website), and a myriad of
        other names. They come in different shapes and sizes. Laks.com has one
        that's a watch. Some come with built-in MP3 capabilities, voice
        recorders, and many other features. Dell has told customers that it's
        going to phase out floppy drives in favor of USB Memory Keys and more
        USB slots on the front or sides of their systems and laptops. The USB
        Memory Keys gain their power from the USB slot. They mount like a hard
        drive and, except on Win 98, don't need a driver except with what
        comes with Windows, Mac, or Linux for USB devices. My RedHat 9 sees it
        at /dev/sda1 when I inserted it. I found this out when I su'd to root
        and then did tail -f /var/log/messages upon inserting the drive. I
        then tried mounting it with an ordinary mount command and voila -- it
        worked.

        Floppies and zip/jazz drives, essentially, are history and will go
        down as klunky, noisy, slow, unreliable devices that took us three
        decades to get rid of.

        So, anyway, my Dell USB Memory Key works great with my PHP projects.
        Happy code tote-ing!

        Comment

        • Jan Pieter Kunst

          #5
          Re: PHP Portability Tip

          In article <25d8d6a8.03101 22038.925070d@p osting.google.c om>,
          googlemike@hotp op.com (Google Mike) wrote:
          [color=blue]
          > I often go between my day job and my home, carrying code. I used to
          > either email it to myself and pick it up, or FTP it to my website, or
          > risk everything and put it on a floppy. (Most often the floppy would
          > fail.)[/color]

          I use CVS over SSH to keep home and work in sync. This also has the
          advantage that your code is duplicated (instant backup). Of course, you
          need a machine somewhere to which you have SSH access from home and work
          to host the CVS repository for your code.

          More about CVS: <http://cvsbook.red-bean.com/cvsbook.html>

          JP

          --
          Sorry, <devnull@cauce. org> is een "spam trap".
          E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

          Comment

          Working...