By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,719 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,719 IT Pros & Developers. It's quick & easy.

PHP Portability Tip

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <go********@hotpop.com> wrote in message
news:25*************************@posting.google.co m...
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.

Jul 17 '05 #2

P: n/a
Google Mike wrote:
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


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: du*******@airpost.net
jabber: lu*@jabber.4002.org
ICQ: 76235870

Jul 17 '05 #3

P: n/a
"Michael Willcocks" <mi*****@metrogroup.com.au> wrote...
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.


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!
Jul 17 '05 #4

P: n/a
In article <25*************************@posting.google.com> ,
go********@hotpop.com (Google Mike) wrote:
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.)


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, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.