Tag Archive for developer

Install Apache2, MySQL5.5 and PHP5.3 on OSX Lion

If you just installed OS X Lion or upgraded from Snow Leopard to Lion and want to use it as a developer web-server so it is possible.

This guide will help you get Apache2, MySQL5.5 and PHP5.3 to work on your machine so you are ready to develop without internet.

What you are installing when you follow this guide:
- Apache 2.2
- PHP 5.3
- MySQL 5.5

PHP modules are also being installed:
- php5_xdebug
- php5_mysql

Why I have chose PHP 5.3 instead of PHP 5.2 or older version of PHP:
This is due to PHP 5.3 allows me to use the namespace which only come in PHP 5.3, with the namespace I muglihed to bursting with my code even better.

Not only that I have personally afferet that with namespaces involved, I have the opportunity to wrong my files into very small bites are also known from C # when this is a natural thing for many developers.

Before you install:
The first thing you should do is to download and install MacPorts from their website MacPorts remember to have our latest Xcode installed to suit OS X Lion

Once installed, you can now open your terminal and install both Apache, PHP and MySQL

Start you basic setup:
Open your terminal and type the following lines

sudo port install apache2
sudo port install php5-devel
sudo port install mysql5-server-devel

It may take a little time, so take it one cup of coffee, cola or tea.

Now you are ready to install the following PHP modules which now must be on your system in my personal opinion, you can obviously do without the modules you do not want to install.

sudo port install php5-gd
sudo port install php5-imagick
sudo port install php5-memcache
sudo port install php5-memcached
sudo port install php5-mysql
sudo port install php5-openssl
sudo port install php5-soap
sudo port install php5-xdebug
sudo port install php5-curl
sudo port install php5-gettext

Once all your models are installed for PHP, we now config your MySQL database, it is done by us to install mysql’s database and then set the password for the root user.

sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'

For Apache and MySQL to even start up, you then use these 2 command lines!

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Now go into the Apache config file and paste the following 2 lines, search for AddType and LoadModule when you insert each simple line, it is very nemer, you use “nano” as a terminal editor, press the button (ctrl + w) to search

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

Search DirectoryIndex and add filename “index.php” and then you save again by pressing ( CTRL + O ) and then ( Y )

To start Apache and MySQL up without having to reboot your machine, type 2 command lines.

sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start
sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start

Are you unlucky as I was that Apache gives this error message “httpd: Could not reliably Determine the server’s Fully Qualified Domain name, med Pariss-MacBook-Air.local for server name” you need to find ServerName in the httpd.conf file as you continue to have open and write your hostname as you can see the error message, what you write may look like this.

ServerName Pariss-MacBook-Air.local:80
 
Now you can save the file and pressing ( CTRL + O ), followed by "Y"

To create shortcuts to both MySQL and Apache which makes it faster for the restart, stop and start if someone were to go wrong can be done by writing these 2 lines.

alias apache2ctl='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper'
alias mysql5='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper'

Good luck and happy development

Xcode 4 Developer Preview

Som Apple udvikler får man adgang til værktøjer før end de der ikke har en udvikler licens hos Apple, dette priser jeg mig lykkelig over på grund af den mail jeg har fået af Apple for en lille uges tid siden nermlig at jeg nu kan hente “Xcode 4 Developer Preview”

Det der er rigtig fedt som jeg er alle mest glad for de har ændret er at nu er alt i 1 vindu isted for før hvor alt bare flere vinduere og fordelt over “flere programmer” dette har de valgt at skære ned på og som bruger af deres Xcode er jeg meget glad for deres valg.

Ud over dette er der også kommet mange andre tiltag, som jeg ikke helt vil skrive her men som i kan læse om på Apples egen side, men alene det nye Xcode 4 kommer er grund nok til at jeg kan anbefalde at få en Apple udvikler licens.

Hvis nogle vil vide hvad der ellers er kommet så følge dette link http://developer.apple.com/technologies/tools/whats-new.html

MySQL Developer I Exam

Så blev jeg færdig med at læse MySQL Developer I Exam, det har taget lidt tid men det har abslut været det vær, nu skal jeg lige tage lidt test for at se hvor meget der hænger ved og så vil jeg op til en exam i MySQL så leds jeg kan få et bevis på at jeg kan dette :o)

Kan varmt anbefalde at folk der godt kan lide SQL kode at læse den af den simple grund at den går i dybte i nogle af de ting som jeg tror folk bare tager som en selv følge uden at tænke over hvorfor det funger sådan.