All articles, tagged with “linux”

Installing GD2 on Linux and Windows

PHP: GD2 Not installed:|| File and or directory is invalid

First you may be wondering what GD2 is… the official explanation is this “GD is an open source code library for the dynamic creation of images by programmers.” If you have ever come across this error it is probably because you have not installed the GD2 extension in PHP when you first setup your server. So I will let you know how install it in Linux and Windows.

Under Linux: The easiest way is to use your package manager to install it. For example in Debian… “apt-get install php5-gd” or Redhat… “—with-libdir=lib64 —with-gd —with-jpeg-dir —with-png-dir

Under Windows: You will have to download the .tar archive because the binary doesn’t include any extensions. So first make sure that in the “C:\PHP\ext” direct that you see “php_gd2.dll” if you do not see you will have to download it. You can obtain a copy by downloading the PHP5 .tar. Next you have to open your “php.ini” file search for “Dynamic Extensions” and just under that point PHP to the library file like this “extension=php_gd2.dll”

Note: make sure that your php.ini file is configured to look in the “C:\PHP\ext” folder for the extensions. Search in the file for “extension_dir”.

And there you have it you now have full GD2 support for PHP. You can now resize, scale, flip images on the fly.

Setup git on Centos 5.3, Centos 5.4 and make public over ssh

update oct 22. 2009: This method also works in Centos 5.4. I’ll post the epel think below once they’re available

I setup git on a Centos 5.3 server the other day, accessible over ssh. Here are the steps I followed to get things up and running.

Centos’s yum repository does not have git in it, so setup fedoras epel (Extra Packages for Enterprise Linux) repo.

i386:

    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

x86_64:

    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

As root run this command:

    yum install git

Next I’m going to setup a new repository and make it accessible over ssh:

    mdkir /home/username/repo #create directory for new repository

    cd /home/username/repo

    git init

We’ll create a dummy file to get started. If you trying to clone (checkout) an empty git repository, you’ll just get errors:

    touch firstfile

Add all files in this directory to your git repository:

    git add .

Commit the changes you’ve made to the repo:

    git commit

Next we’ll create a clone of the repo and configure it to be public:

    cd /home/username

    git clone --bare ./repo repo.git

    touch  repo.git/git-daemon-export-ok

you can copy your repo.git directory to where you want to make the repo public

Now we want to checkout a copy of the new repository from a different server.

    git clone ssh://yourserveraddress/home/username/repo.git

You should now have a new directory labeled repo which contains the file ‘firstfile’

To add a new file to the repo:

    cd repo

    touch secondfile

    git add .

    git commit

Now we want to submit the changes back to the git server:

    git push

You’ll be prompted for your password.

Enjoy.