Posts Tagged unix
Accessing Your Local MAMP Dev Environment From VirtualBox
Want to know how to access your MAMP environment from within a virtual instance of Windows or Linux (like VirtualBox or VMware fusion or Parallels)? Read on!
You already have a local development environment set up using MAMP (MAMP uses port 8888 so your localhost is accessed at http://localhost:8888 and custom sites, assuming you have set any up, are available at http://whatever:8888).
Sadly you need to test your sites in Internet Explorer (or more interestingly you want to run in Linux and use cool tools like cachegrind) so you have set up a virtual environment to do this. I am using Sun’s Oracle’s fantastic, open source application VirtualBox. The question is, how do you access your local sites from within VirtualBox? Launching IE or your Linux browser and going to http://localhost:8888 does not work… hmmm.
Turns out, the address you need to point at is http://10.0.0.2:8888. That will get you to MAMP’s htdocs directory, i.e. your http://localhost:8888!
Now that is useful but it doesn’t get give you access to your custom sites. Here is how you access those!
- Open your hosts file. In Windows it is found here:
C:\windows\system32\drivers\etc\hostsand in Linux it is found here:/etc/hosts - Under the bit that says:
127.0.0.1 localhostadd the following (using whatever your actual project is called):10.0.2.2 whatever
That’s it! Now you can visit http://whatever:8888 using IE or any other browser from within your virtual Windows and/or Linux environments.
Example hosts file (all I added was the third line):
127.0.0.1 localhost
127.0.0.1 ubuntu-vm
10.0.2.2 mynewsapp
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
etc, etc...
And now in my virtual environment’s browser I can access:
http://mynewsapp:8888/
(which is hosted in my Mac’s MAMP instance! Sweet!)
Zend_Tool Set-up
Posted by Stuart in unix, Zend Framework on May 7, 2009
Download Zend Framework (1.8.0 is the current version at present… change as needed):
wget http://framework.zend.com/releases/ZendFramework-1.8.0/ZendFramework-1.8.0-minimal.tar.gz
Unpack the downloaded file:
tar zxvf ~/Downloads/ZendFramework-1.8.0-minimal.tar.gz
Move into that unpacked directory:
cd ~/Downloads/ZendFramework-1.8.0-minimal
Find out where your PHP binary is:
which php
Put zf.sh and zf.php into the same dir as the PHP binary:
cp bin/zf.sh bin/zf.php /Applications/MAMP/bin/php5/bin/
Find out your include path:
php -i | grep "include_path"
Put the contents of the library folder into that location:
cp -r library/* /Applications/MAMP/bin/php5/lib/php/
Test Zend_Tool:
zf.sh show version
For ease of use, let’s alias zf.sh to just zf. First open your bash login file:
vim ~/.bash_login
Add this line:
alias zf=zf.sh
You are now set up. Next stop, actually creating a project with Zend_Tool!
Using UNIX’s find to locate modified files
This will find anything that was accessed in the past 30 minutes:
sudo find / -amin 30
Finds anything larger than 10k that was modified today:
find / -size +10k -mtime 0
Finds any file larger than 1MB that was not modified in the past year:
find / -type f -size +1M -mtime +365
Finds any php file larger than 1k that was accessed in the past 30 minutes:
find / -size +1k -name "*.php" -amin -30





