• Awning Works 1
  • Socaz 2
  • Socaz 1
  • Randy Montana 3
  • Randy Montana 2
  • Randy Montana 1
  • Rodgers & Hammerstein 3
  • Rodgers & Hammerstein 2
  • Rodgers and Hammerstein 1
  • Love Fine Art
  • Jan
  • 03
  • 2012

Get The Calling Function

Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script.
Getting the calling function is easy in PHP, thanks to the debug_backtrace() function.

Just put the following code wherever in your script you need to know what function is calling the part you are working on.

45
46
47
48
49
50
<?php>
 
$backtrace = debug_backtrace();
print "The function that just called this code is <strong>" .$backtrace[1]['function'] . "<strong>.";
 
</php>

This will output something like this:

The function that just called this code is DrawWidget.

Where DrawWidget is the name of the function.

I hope this comes in handy for someone. Thanks for visiting!

  • Oct
  • 10
  • 2011

PHP and MySQL command line with MAMP on OSX

Posted by admin In MAMP, MySQL, PHP, UNIX / LINIX | No Comments »

I found a handy article named

Getting command line access to PHP and MySQL running MAMP on OSX

by  Joaquin Lippincott .

It was very helpful for getting PHP and MySQL acces from the terminal on a mac.

In addition, one of the comments by Matthew Bacon was about getting the ZEND FRAMWORK up and running with the command line. I have copied it here for your convenience. I hope this helps someone.

Posted by Matthew Bacon on

To anyone who is having problems getting Zend_Tool working on their MAC OS X (10.6) in Terminal, this is how to solve the problem.

Step 1

Download the Zend Framework to your downloads folder. Once downloaded, rename the folder ZendFramework

Step 2

Open Terminal and type: sudo cp -r ~/Downloads/ZendFramework /usr/local/ZendFrameworkCli

Step 3

In Terminal, type: open ~/.bash_profile

Note: If file is not found…

Open the application TextEdit. Create a new file and make sure you are typing in plain text only. Type the following: alias zf=/usr/local/ZendFrameworkCli/bin/zf.sh

Save and exit TextEdit

Step 4

In Terminal, type: zf show version

Done!

 

  • Oct
  • 09
  • 2011

MySQL from the Command Line (terminal) in MAMP PRO

Posted by admin In MAMP, MySQL, UNIX / LINIX | No Comments »
MySQL from the Command Line (terminal) in MAMP PRO

To get to the command line for MySQL for MAMP or MAMP PRO just open up you terminal and enter the following:

 
/Applications/MAMP/Library/bin/mysql –host=localhost -uroot -proot

You can see all the databases by using the following command:

mysql command line command show databases

If you type the MySQL command : USE <table name>  you can then start using that particular database.

Another convenient command is SHOW TABLES. Can you figure out what that does?

Now you can type MySQL commands right from the command line.

 
 
 
  • Jan
  • 30
  • 2011

MAMP: Dealing with HUGE MySQL Queries

Posted by admin In MAMP, MySQL, Web Design | No Comments »
MAMP: Dealing with HUGE MySQL Queries

After importing a relativly huge table into my local dev using MAMP, I was experiencing MySQL hangups on large queries that when on a live site would be no problem.

To fix this I made the following adjustments to the MAMP PRO my.cnf  file.

The my.cnf file is edited in MAMP PRO pulldown menu by clicking on  FILE>>Edit Template>>MySQL my.cnf
MAMP my.cnf file edit

Notice starting on line 30 (image below) that I made changes to buffer allowances and memory allowances etc.
Basically just making everything bigger. I could hone this to the “best sizes” but really i don’t have time
and this is just for my local dev so threw some pretty big numbers in there for plenty of elbow room. IF you have any suggestions or have optimized your my.cnf file please feel free to make a comment.

Screen shot 2011-01-30 at 5.33.19 PM

  • Jan
  • 24
  • 2011

How to Get Port 80 Working on MAMP

Posted by admin In Apache, How To, MAMP | No Comments »

Thanks James for the following advice:

Got to step 7 and it worked for me!

1) Take some tea
2) Follow these instructions:
3) Disable Web Sharing in System Preferences
4) Open MAMP, make sure servers are stopped
5) Open Preferences panel in MAMP
6)  Switch to Ports, set Apache Port to 80. Click OK.
7)  Try starting your servers.
* If it doesn’t work, manually review your httpd.conf file (within the MAMP application folder) and make sure that there are no active references to 8888

BTW: you can turn Web Sharing back on after these steps and it will keep working on Port 80.

  • Sep
  • 13
  • 2010

Import WordPress Database from Staging Server to Local Development Server

Posted by admin In MAMP, MySQL, WordPress | No Comments »

You may be working with a WordPress project and wish to use SVN to have a development instance, a staging instance, a local development instance and of course a production instance of the web site. This could prove to be problematic in keeping track of your data base instances. WordPress stores the root URL (http://website.com) at several places in their database. This can cause a problem when you try to import a copy of one of the live databases to your local development environment. When ever you click on a link it will send you to the live instance instead of remaining on your local environment. A way around this, for local development environment purposes, would be as follows:

  1. prior to importing the .sql file, open it in your favorite code editor. I like to use BB Edit.
  2. Perform a search and replace on the .sql file for the root url.
  3. ie:  search for “http://www.livestagingserver.com” and replace with “http://mylocaldev.me”
  4. Save the file and import it into your local WordPress data base.

Now whenever you click on your posts in your local development environment the links will stay within your local development environment.
This way, you can keep a local copy of your database so you have a faster and more local way of working. This also serves to keep the live instance of the database from getting contaminated with the residual artifacts of development work.

  • Feb
  • 13
  • 2010

Navicat Connetion with MAMP Pro

Posted by admin In Drupal 6 & Drupal 7, MAMP, MySQL | No Comments »
Navicat Connetion with MAMP Pro

MAMP Pro has a lot of nice features. However, this means it changes things up a bit. How you make a connection with Navicat is one such example. So here is a quick helper post get Navicat up and running with MAMP PRo.

1) Add your information to the “Connection Properties” Pane as you normally would.

Navicat Pane -General

2) Click on the “Advanced” pane and check the box next to “Use socket for localhost connection.”

3) Then for the “Socket File Path” field type the following path.

/Applications/MAMP/tmp/mysql/mysql.sock

The “Advanced” Pane should now look like this:

Navicat Advanced Pane

Click “OK” and you should be all set.

Navicat Connection Sucessfull

I hope this helps. Please feel free to make comments.

  • Jul
  • 24
  • 2009

Creating Virtual Hosts ON Your MAC for MAMP

Posted by admin In MAMP, UNIX / LINIX, Web Design | No Comments »

Open up the terminal.
1)    Web-Two:~ webtwo$  cd /etc <–change directory to the etc directory

2)    Web-Two:etc webtwo$ sudo nano hosts <–super user do (does not stay logged in),  editor, file=hosts

3)    Password: *******  <– enter password

4)   Editor opens up. You will see something like this…

#
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

5)  Type in the local IP followed by the name of the site you wish to make a virtual host for:
ie. 127.0.0.1 yoursite.you <– replace this with your name
You should do this for each site you wish to make a virtual host for , line by line.
Your /etc/hosts   file should now look more like this:
#
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1 yoursite.you

127.0.0.1 anothersite.you
127.0.0.1 yetanothersite.you

6)  Exit your editor, in this example I used, nano. Note: Be sure to SAVE the file.

7)  OK, now navigate to the file:    Applications/MAMP/conf/apache/httpd.conf  and open it in a text only editor ( like BBedit or Smultron or something )

8)  Scroll to the bottom of the httpd.conf file. For each site type in the following:

<VirtualHost *>
DocumentRoot “/Users/yourusername/Sites/site-folder-name”  <– replace with your own appropriate info
ServerName  localsite.you
<– replace with your own appropriate info
ServerAlias localsite.you <– replace with your own appropriate info
<Directory “/Applications/MAMP/htdocs”> <– do NOT change for MAMP
AllowOverride all  <– this allows the htacces file to work properly
</Directory>
</VirtualHost>

9) Save the Applications/MAMP/conf/apache/httpd.conf    file and RESTART your MAMP server.

Now, when you type in the  site   www.localsite.you  followed by your MAMP port (usually 8888) like this:

http://www.localsite.you:8888 your site will come up!

Hope this helps!

  • Jul
  • 24
  • 2009

Viewing the Websites You Are Developing Locally on Your Computer Using MAMP

Posted by admin In MAMP, UNIX / LINIX, Web Design | No Comments »

Normally, when using MAMP ( I am presently using the FREE version of MAMP) you view the site you are working on in a couple of ways.

Put your web site in the    /Applications/MAMP/htdocs/     folder and point your browser to   http://locahost:8888/

or (This is what I like to do for multiple site management)

Put your sites in appropriately named folders under the “Sites” folder.
Click on MAMP Preferences and select the “Apache” tab. Then click the “Select” button and browse to the “Sites” folder.

That way, you can easily get to any of the folders by typing in the URL http://localhost:8888/. You will be presented with a list of folders (as links). These folders are the sites you are developing under the Sites directory. Just click the folder (link) you wish to view and you’re there.

Hope this helps!

Flickr Stream