Author: Dan
-
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.
-
Last Saturday I enjoyed a long, gentle walk along, over, around and across the south downs. Starting at Hassocks I traced a meandering perimeter around my home town of Brighton, enjoying unexpectedly bright weather and the gentle teasing chill of the first winds of winter. I was followed down from Hassocks to Clayton by a somewhat strange gentleman in board shorts and hoodie, who maintained a safe distance as might a (somewhat ineffective) spy going about reconnaissance. Emerging on to the A273 we parted ways however, as I paused to admire the northern exit from the Clayton tunnel, infamous for the horrific rail crash which resulted from a signalman’s failure on a Sunday morning in 1861. The tunnel exit is lovely though, with two turrets standing guard beside a privately owned cottage straddling the tunnel exit.
Onwards and upwards I clambered to the Jack and Jill windmills, a glimpse of which I often catch as we emerge from the tunnel on the train each morning. Atop Jill were a couple of American gents, who appeared to be up there to enjoy the view more than anything else – and why not?! I know now these were most likely members of the Jack and Jill Windmills Society , whose volunteers have been responsible for carrying out the incredible restoration work most evident on Jill, the white windmill (Jack is privately owned).
I was spurred onwards by the appearance of a somewhat elderly looking chap in jeans and workman’s polo shirt, who emerged from nowhere seemingly, smiling from a wrinkled olive-tanned face as he strode past me before breaking unexpectedly into a run, which he maintained until he was out of sight.
Now turning east along the wide chalk bridleway of the South Downs Way I walked under white clouds and intermittent bursts of blinding sunshine. I found my rhythm under duress as the light wind of the morning grew more confident in the afternoon. Spindly bushes and trees, tested by the constant bluster over the years, formed gravity-defying silhouettes against the bright backdrop of the autumn sky.
I sipped coffee from my thermos at Burnt House Pond, a dew pond, or mist pond, constructed to retain water for the grazing of sheep through the warm summer months. Whilst these ponds must certainly retain some water condensate from the dense disorientating fog and mist of the downs micro-climate, the vast majority is gathered from rainfall, the annual volume of which outstrips the evaporation significantly. But the names are evocative and I enjoyed my time beside the pond, sharing a moment with the birds and bushes enjoying the tiny hilltop oasis.
Past Ditchling beacon, with it’s concentration of dog walkers attracted to the nearby car park, I plodded on into the National Trust reserve at Blackcap. I ate lunch sheltering from a light rain under a comfy tree, polished off my coffee and ventured off the south downs way into the shallow valley of Ashcombe Bottom, with it’s feeders and fences offering a haven to hundreds of pheasants which roam the woodland, greeting the walker at every turn. Dipping off the well trodden path through the wood, I found a perfect tree for climbing, and setting my pack to one side I became a child for 15 minutes, learning the tree as I climbed it in as many ways as I could find, pausing to reflect on the sounds of the nature around me at the top.
And so on I plodded, down through the off-piste tracks of Ashcombe Bottom to rejoin the South Downs Way, across the long wound of the A27, bleeding noise over the landscape, and onward around the shallow bowl of Cold Coombes. Somewhere along the ridge over Front Hill, I crossed without fanfare from the Western to Eastern hemisphere, and turned off the Way down into Rodwell in hopes of enjoying a beer at the local pub. Fate had other plans, as it was at this point I thought to check the trains from Southease. Needless to say, they were infrequent, and so it was that I broke into a hesitant jog for the last mile or so down towards the somewhat famous swing bridge at Southease. The bridge, restored in 2010, was originally built in the late 19th century. Whilst it retains all the moving parts requisite for operation as a swing bridge, it was actually last opened in 1967, and today is a fantastic example of the engineering methods of the time – one can clearly see all of the mechanised components and imagine the bridge in action. I arrived in plenty of time to enjoy the sun setting behind the hills along which I had spent the day, illuminating the sky in a plethora of reds, pinks and oranges.
-
The floors creak in daunt books. Books line the walls of two storeys of stories and the musty perfume of crisp parchment, perfectly typeset pages of knowledge and narrative, fills the air. The weight of human creative and academic pursuit is carried on that scent. It has gravity. With each step a creak, that imposes upon that gravity, unavoidably of course until one settles on a shelf. But which shelf? No keyboard to tap on to search here, just broad categories and alphabetisation. All the better to stumble upon something a little different – a discovery of one’s own, rather than the sterile, predictable recommendation of a computer. When you’re perusing those shelves, you become the entropy in the system, the occasional mutation in the otherwise predictable algorithm which internet-bound shoppers rely upon and follow for inhuman guidance.
James Daunt, founder and namesake of this literary cornucopia, has made a success of his latest challenge at the helm of Waterstones. Once a shop which I avoided, recent experiences at Waterstones have been overwhelmingly positive. The staff are knowledgable and very helpful. The displays are interesting, relevant and varied. The shelves are well stocked. I feel compelled to purchase at Waterstones now, and branches I’ve used in Clapham and Brighton have become places of discovery similar to Daunt Books. My reading is slow enough for this to be bad news, for my backlog is growing at a tremendous rate, but you can never have enough books, can you?
In other news, I’m very excited to have managed to scrape a ticket for TEDx Brighton on 25th October. I’m particularly looking forward to hearing from Aral Balkan, whose Prometheus initiative is something I’d love to get involved in, and who is heavily involved in Code Club. I also share a (relatively passive) interest in the application of mathematical analysis to sociological phenomena with Mick Taylor, a mathematician whose OurFest experiment sounds incredibly interesting.
-
At the dinner table, on the veranda in Spain, we discussed a question which I was pondering:
“Is historical study an art or a science?”
I’m aware that there is no answer to this somewhat pointless question, and after a few false starts during which we established this fact we had a lively discussion, primarily with myself arguing that history is science and Lucy arguing the alternative. Lucy had a strong case, suggesting that history is interpretation above all else, and that interpretation and dissemination of records of events is itself likely to lead to a narrative proxied through the perspective of a particular individual, and this narrative – with the emotional imprint of it’s author – is art. My counter argument is that whilst I accept that this may be the reality of historical interpretation, it is not the goal. A historian is aware that some event occurred, and it is their job to bring their understanding of the event and it’s context as close to the truth – the reality – of the occasion, as possible. In this, history is much more akin to science. The historian, as the scientist, establishes a hypothesis – a theory – and seeks evidence to support that theory.
So it was by a fortunate stroke of serendipity that I came across Lockhart’s Lament in my Evernote inbox whilst writing a short journal entry yesterday and resolved to read it (after 3 years…). The essay is a criticism of contemporary mathematical education, and the first point the author seeks to establish is that mathematics is much more art, than science. With reference to the role of approximation in mathematical thought-experiment, Lockhart comments:
“That’s just not simple, and consequently it is an ugly question which depends on all sorts of real-world details. Let’s leave that to the scientists.”
The implication here, that art disregards the imperfect and deals in the abstract; focusing on only particular attributes of the detail, is a wonderful interpretation of the essence of mathematics. It rationalises Lockhart’s emotional exclamation “…that there is nothing as dreamy and poetic, nothing as radical, subversive, and psychedelic, as mathematics.”
The counter-example, focusing necessarily on all details in order to paint the most complete picture, to include all the required context for interpretation, is my argument for history as science. My stance, in retrospect, was weakened upon reading G.H. Hardy’s excellent description, as quoted in Lockhart’s Lament:
“A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.”
G.H. Hardy
I agreed with one of Lucy’s assertions regarding the reality of historical analysis: historians cannot afford to consider every detail. They, as per Hardy’s mathematician, must establish patterns and demonstrate fluidity in their narrative in order to justify the abstraction of certain details. The careful abstraction of these details without detracting from the plausibility of her interpretation of events is the historians art.
Have I convinced myself? Is history art? No. Whilst in practise artistic compromises may be necessary, I still believe that the historian’s plight is to establish theories which come as close to fact as possible.
More on Paul Lockhart’s excellent “A Mathematician’s Lament” in a later post.
Image credit: Photo by National Cancer Institute on Unsplash