• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

apache

MAMP – MySQL can’t connect after OS X Crash

September 4, 2012 by Webhead

Problem

I had my macbook open, it went to sleep and I couldn’t wake it up.  After holding down the powerbutton for over 10 seconds, it turned on.  Everything was fine until I tried to open the MAMP home page.  MySQL couldn’t start.  the error logs showed:

InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
120904 14:51:31 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1

Solution

Solution is to find the mysqlid process and end it.  Then restart MAMP and things should be good to go.  more details on this great post:

http://aralbalkan.com/1931

 

Another Problem

When visiting phpMyAdmin you get the following errors:

“Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.”

Another Solution

Clear your browser cache.

thanks to: http://stackoverflow.com/questions/5013118/cannot-start-session-without-errors-in-phpmyadmin

 

 

keywords: mamp check that you do not already have another mysqlid process

Filed Under: Server Stuff Tagged With: apache, linux, mac os x, mysql

MAMP optimizations

May 18, 2012 by Webhead

“Optimizations” in the sense that you’ll have to do less work.  This website gives some great tips on saving you some time using MAMP.

http://www.sitepen.com/blog/2008/05/16/supercharge-mamp/

This site below actually helped me with the silent MAMP startup.  Read the comments on this page for updates on getting it to work with version 2.  It’s so good to not deal with the GUI and entering my password!

http://stringfoo.com/2008/08/25/tutorial-launching-mamp-silently-on-startup/

 

The 2nd website no longer exists and I’m afraid the first one will be gone.  Below are the steps required to start MAMP 3.x without the GUI automatically on startup:

  1. Use Standard Ports
    • Set the web port 80 and and MySQL port to 3306 by using the MAMP GUI preferences.  There’s even a button to set it so you don’t need to type it.
  2. Set up Virtual hosts (optional)
    1. Create the directory /Applications/MAMP/conf/apache/vhosts
    2. Open /Application/MAMP/conf/apache/httpd.conf and add this to the end:
      1. NameVirtualHost *:80
        Include /Applications/MAMP/conf/apache/vhosts/*.conf
    3. Restart Apache
      1. sudo /Applications/MAMP/bin/apache2/bin/apachectl restart
  3. Run MAMP at startup without having the GUI popup.
    1. Put the following in /Library/LaunchDaemons/USERNAME.mamp.start.apache.plist  replace USERNAME with your username in both the filename and the contents below.
      1. <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
        <plist version="1.0">
         <dict>
         <key>Disabled</key>
         <false/>
         <key>Label</key>
         <string>corey.mamp.start.apache</string>
         <key>ProgramArguments</key>
         <array>
         <string>/Applications/MAMP/Library/bin/apachectl</string>
         <string>start</string>
         </array>
         <key>RunAtLoad</key>
         <true/>
         </dict>
        </plist>
    2. Create /Library/LaunchDaemons/USERNAME.mamp.start.mysql.plist  replace USERNAME with your username in both the filename and the contents below.
      1. <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
        <plist version="1.0">
         <dict>
         <key>Label</key>
         <string>USERNAME.mamp.start.mysql</string>
         <key>ProgramArguments</key>
         <array>
         <string>/Applications/MAMP/Library/bin/mysqld_safe</string>
         <string>--port=3306</string>
         <string>--socket=/Applications/MAMP/tmp/mysql/mysql.sock</string>
         <string>--lower_case_table_names=1</string>
         <string>--pid-file=/Applications/MAMP/tmp/mysql/mysql.pid</string>
         <string>--log-error=/Applications/MAMP/logs/mysql_error_log</string>
         </array>
         <key>RunAtLoad</key>
         <true/>
         <key>UserName</key>
         <string>corey</string>
         </dict>
        </plist>
    3. Change the file permissions using the following commands:
      1. sudo chown root:wheel USERNAME.mamp.start.apache.plist
        sudo chown root:wheel USERNAME.mamp.start.mysql.plist

 

Filed Under: Coding Tagged With: apache, linux, optimize

Page Speed SEO

April 4, 2012 by Webhead

One of the metrics for Search Engine Optimization is the time it takes to load a page.  With Google’s PageSpeed tool, you can see if your page is loading optimally.  One of the ways to better your page loading is by leveraging browser cache.  The article below explains it well.  What I did was a little simpler.  I basically just bypassed all the ExpiresByType and just put the ExpiresDefault in my .htaccess.


<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 2 week"
</IfModule>

keywords: leverage browser caching
source: http://thomasgriffinmedia.com/blog/2010/11/how-to-leverage-browser-caching-in-wordpress-via-htaccess/

Filed Under: Coding, Server Stuff Tagged With: apache, google, htaccess, seo

Weblog Expert

September 22, 2011 by Webhead

Problem

A client had wanted Google Analytics on their site a few months back so they asked me to put it in their website.  I thought I had, and I did, locally, but for one reason or another, it was not on the server.  The client depends on this report to get funding so I needed a way to get some type of statistics for the past few months.

 

Solution

GoDaddy, where the website is hosted, offers Statistics on traffic for free.  However, you need to enable this for it to start tracking.  Searching high and low I wanted to get access to the Apache Logs so I could use a tool like AWStats.  Through google I found GoDaddy’s help and saw that you can see Apache Logs in your FTP File Manager.  So I downloaded it.

A friend ran across Weblog Expert as I was retrieving the files.  I decided to try it since my last memory of AWStats was spending hours trying to find the right paths to enter into the config file.  Weblog Expert Lite is free and contains enough features for me to use.

I downloaded Weblog Expert Lite, installed it (it is a client installed on your local PC), created a new profile, selected the folder with all the downloaded logs.  Presto!  the reports were created and I was out of hot water.  So much simpler than AWStats.

 

Filed Under: Tools Tagged With: apache, goDaddy

Useful Linux Commands

September 16, 2011 by Webhead

I recently had to move a server and needed to set up another server. I’m a linux newbie so I needed to look up a lot of things. Below are some of the more common commands that I needed: (replace with your own command/name).

Create a short name or alias to run a command.

alias =''

Create a symbolic link to another directory/file

ln -s

http://kb.iu.edu/data/abbe.html

Transfer files from your computer to a server

scp  :

Transfer files from a server to another server.

scp : :

Change file owner w/ recursion

chown -R :

Change file permissions for web w/ recursion

chmod -R 644

Find a file

find / -name

http://content.hccfl.edu/pollock/unix/findcmd.htm

Add a user

sudo useradd -d /home/ -m
sudo passwd

Change a users’ primary group

usermod -g

Add a group

groupadd

Add a user to a group

usermod -G

Make everything in a dir owned by the dir group owner

sudo chmod g+s

Find largest 10 files in wp-content folder

find wp-content -type f -exec du -h {} + | sort -rh | head -n 10


Filed Under: Server Stuff Tagged With: apache, linux

Mac OS X Linux Stuff

September 15, 2011 by Webhead

Locations and commands on the Mac OS X vs any other Linux/Unix system are different.  Below are some of the locations and commands I ran across in setting up my macbook as a webserver.

apache2 is located in

/etc/apache2/

Along with the httpd.conf:

/etc/apache2/httpd.conf

By default apache2 logs are located at:

/var/log/apache2

By default files in the root directory are at:

/Library/WebServer/Documents/

To restart apache:

sudo /usr/sbin/apachectl restart

or

sudo apachectl -k restart

To Enable PHP, in httpd.conf remove the ‘#’ from this line:

#LoadModule php5_module        libexec/apache2/libphp5.so

Filed Under: Server Stuff Tagged With: apache, linux, mac os x, php

  • Go to page 1
  • Go to page 2
  • Go to Next Page »

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization macOS mac os x ms sql mysql open source optimize php php 7.2 rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools
  • Uncategorized