Dan Everard.

  • Store
  • Galleries
    • Travel
    • Landscape
    • Street
  • About
  • Portal

    May 3rd, 2014

    Portal

  • London City Street Walk

    May 3rd, 2014
    Railway Bridge
    Blissfully unaware of his shadow
    Up there
    Development
    At Cannon Street
    At Cannon Street
    Bypasser
  • Light up

    May 2nd, 2014

    Light up

  • Birthday Boy

    May 2nd, 2014
    On a more serious note boy...
    On a more serious note boy…
    Make a Wish
    Smiler
    My grandad playing up to the camera.
    My grandad playing up to the camera.
  • Sunbathe

    May 1st, 2014

    Sunbathing

  • Battersea Benches 2

    May 1st, 2014

    Battersea Benches 2

  • Battersea Park Paving

    May 1st, 2014

    Battersea Paving

  • Battersea Benches 1

    May 1st, 2014

  • Lockers

    May 1st, 2014

    Lockers in Denmark

  • Installing Apache on Mac OS X

    January 11th, 2014

    Mac OS includes Apache and PHP, which is a bit handy for us developers. We all need a local environment and it helps if the local environment looks and feels a bit like the terminal ssh session we use to manage our production server. Configuration can be a little tricky however, and things change from version to version of the OS…

    LAMP?

    We’ll end up with a LAMP stack (more or less). LAMP is an acronym for:

    • Linux
    • Apache
    • MySQL (or MariaDB, MongoDB)
    • PHP (or Perl or Python)

    Whilst Mac OS is not Linux, it’s Unix-based so it’ll do…

    Steps

    • Check Apache
    • Enable PHP
    • Add virtual host configuration
    • Restart and check configuration
    • Install MySQL
    • Configure MySQL
    • Install additional tools

    Check and Run Apache

    Only run the start command if required…

    $ ps aux | grep httpd
    
    ...
    _www              431   0.0  0.0  2463684   1744   ??  S     8:23pm   0:00.00 /usr/sbin/httpd -D FOREGROUND
    ...
    
    $ sudo apachectl start

    Enable PHP

    $ sudo vi /etc/apache2/httpd.conf
    
    ...
    # Ensure this line is uncommented
    LoadModule php5_module libexec/apache2/libphp5.so
    ...

    Virtual Host Configuration

    $ less /etc/apache2/users/myusername.conf
    
    <VirtualHost *:80> 
            DocumentRoot "/Users/myusername/Sites" 
            ServerName myusername.local 
            ErrorLog "/private/var/log/apache2/myusername.local-error_log" 
            CustomLog "/private/var/log/apache2/myusername.local-access_log" common 
    
            <Directory "/Users/myusername/Sites"> 
                    AllowOverride All 
                    Order allow,deny 
                    Allow from all 
            </Directory> 
    </VirtualHost>

    Check Your Work

    Restarting Apache allows us to check this configuration is working. Create a directory “test” in /Users/myusername/Sites. Create a “hello world” index.html.

    Restart Apache

    $ sudo apachectl restart

    Navigate to http://localhost/test/index.html. You should see your “hello world”.

    403 Forbidden…

    Argh! Pain! Apache runs under the _www user. This user needs to have 755 permissions to each directory in the heirarchy your site is located in. Chmod away…

    $ chmod 755 /Users/myusername/Sites
    $ chmod 755 /Users/myusername
    $ etc...

    Installing MySQL

    MySQL is now distributed as a nice DMG package. Download it, install MySQL (open from the context menu if OSX complains about the legitimacy of the developer), and then install the preferences panel which adds MySQL to your preferences. Nip over to the shiny new settings pane and switch on MySQL. Check it out – it runs under a system user called mysql which has been available in MacOS installs for some time now.

    $ ps aux | grep mysql
    _mysql 1065 ... /usr/local/mysql/bin/mysql

    Additional Tools

    At least install a database admin tool locally. PHPMyAdmin does the job admirably – you’ll install it hosted in your new Apache PHP environment so there’s a nice circularity there… Alternatively use a MacOS database management application.

←Previous Page
1 … 4 5 6 7 8 … 11
Next Page→
 

Loading Comments...