This post has been moved here
This blog has been moved here
1 year ago, I had no idea of what was git, I was using svn for my projects. Someone told me about Git and taught me the basics about it. So my turn to introduce you to Git.
Git, like SVN is a versioning system with some advantages:
go in your home dir and edit the ‘.gitconfig’ file, or create it, if it does not exist. In this file you will put your name and email address like this
[user]name = your name here email = your email here
You can also add other options here, but we will not talk about that here.
Next, we are going to create the git project
mkdir project
cd project
git init
The git init command let’s you initiate a git repo in the current folder.
Than, we create a README file and add it to git.
touch README
git add README
The README file is added, but not committed yet. The difference between SVN and GIT is that when you commit your changes, they are only committed locally, you have to push them to the server.
git commit README -m 'first import'
A commit message is mandatory and cannot be empty.
The changes are now committed locally and you can check this by typing
git log
This will open the commit log file and display the list of all your commits.
If you create now a new file in the directory, it will not be added to the git repo. You can check that by typing git status and this will show you which files have been modified since last commit and which file are not added to the git.
To add all the files contained in the directory you can type
git add .
This will add all the files included hidden ones, swap file, tags …
To exclude a type of file or a specified file you need to create a .gitignore file and list there the files you want to exclude or a pattern.
For example to exclude all swp files add *.swp in the .gitignore file.
Don’t forget to add the .gitignore file with git add .gitignore otherwise it will not be taken in consideration.
If you’ve added a file to the git that you dont’ want you can remove it with git rm [file], but this will delete it from your disk. If you only need to delete it from the git and keep it on the disk type git rm [file] --cached
Here ends the first part of the introduction to git. You know how to create a local git repo, add files to it and commit them locally.
Next time I will explain how to add a remote repository, push to the server, compare a commit, and a lot of other useful stuff that git provides.
Apple provides with MacOs an Apache Server and PHP, but the php module is disabled by default. You can simply enable it and have a full apache server running.
First of all, open the Terminal (located in Applications/utilities/Terminal.app). Than you need to open the apache configuration file located in /etc/apache2/httpd.conf. Of course you need to edit it as root otherwise you will not be able to save your changes.
To do that type the following command in your Terminal:
sudo vim /etc/apache2/httpd.conf
I use vim but you can also edit the file with another text editor. For instance:
sudo open /etc/apache2/httpd.conf
This will open the file with your default text editor.
After that, you need to locate the following line
#LoadModule php5_module libexec/apache2/libphp5.so
And uncomment it by removing the ‘#’ at the beginning of the line. Once this is done, save the file and close the editor. You should be able to start the apache server and load a php page, but if you want to be able to customize your PHP installation you need to do a few more steps.
To do that, you need to copy the php.ini.default file located in /private/etc into php.ini, because PHP uses the php.ini file when loading the configuration. To do this type in your Terminal
cd /private/etc/
sudo cp php.ini.default php.ini
Now your PHP configuration file is created. You can edit it and change PHP settings in there.
You can start the apache server by going to System Preferences -> Sharing and select Web sharing, or more simply by typing in a Terminal
sudo apachectl start
To stop the apache server replace start by stop in the command
That’s it, your Apache server with PHP is up and running. Your php pages must be placed in your Sites folder located in your home folder.
Next time I will explain how to change the root directory of the apache server and create virtual hosts