Nasrul Hazim Bin Mohamad

Laranix: Just like Laragon


Having an issue with Laravel installer on Ubuntu, ended up writing small bash script which can:

  1. Create new Laravel project
  2. Change bootstrap/cache & storage to writeable
  3. Create VirtualHost automatically (using RoverWire/virtualhost)

This small script similar to Laragon, but this one for Linux users. ūüôā

Grab the script here to simplify your work with Laravel!

Ubuntu: LDAP – Install, Configure & Test


I’m using Ubuntu 12.04

LDAP: Install & Configure

  1. sudo apt-get install slapd ldap-utils
    1. Enter password: [SetY0urP@$$wOrD]
  2. dpkg-reconfigure slapd
    1. Omit OpenLDAP server configuration? No
    2. DNS domain name? | IP Address
    3. Organization name? My Organization
    4. Administrator password? Use the password during installation | Choose new one
    5. Database backend to use? HDB
    6. Remove the database when slapd is purged? No
    7. Move old database? Yes
    8. Allow LDAPv2 protocol? No
  3. joe /etc/phpldapadmin/config.php (i’m using joe text editor, you may use the default text editor such vi)
    $servers->setValue('server','host',' | IP Address');
    $config->custom->appearance['hide_template_warning'] = true;

LDAP: Install PHPLDAPAdmin

  1. apt-get install libpam-ldap nscd | pkg-reconfigure ldap-auth-config
    1. LDAP server Uniform Resource Identifier: ldap://**Domain-Name-OR-IP-Address** (¬†Change the initial string from “ldapi:///” to “ldap://” before inputing your server’s information )
    2. Distinguished name of the search base: (¬†This should match the value you put in your LDAP server’s/etc/phpldapadmin/config.php file. )
    3. LDAP version to use: 3
    4. Make local root Database admin: Yes
    5. Does the LDAP database require login? No
    6. LDAP account for root: This should also match the value in your /etc/phpldapadmin/config.php
    7. LDAP root account password: LDAP-Root-Password
  2. joe /etc/nsswitch.conf –¬†add ldap before compat for each passwd, group, shadow
  3. joe /etc/pam.d/common-session –¬†add at the bottom: session required skel=/etc/skel umask=0022
  4. /etc/init.d/nscd restart
  5. Access to PHPLDAPAdmin:

LDAP: Setting up LDAP Groups & Users

  1. Go to
  2. Login DN: cn=admin,dc=domain,dc=com
  3. Login Password: Password configured during slapd configuration
  4. To do:
    1. Create an Generic: Organization Units named Users
    2. Create a Generic: Posix Group named groups
    3. Create one or more Generic: User Account¬†(make sure it’s under ou=users)
    4. (Optional) Add users to groups by clicking a group & Add New Attribute. Select memberUid and click on Update Object at the bottom.


ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); 

$ldapconn = ldap_connect("")
    or die("Could not connect to LDAP server.");

$person = 'cn=username,ou=users,dc=domain,dc=com';
$password = 'password';

if ($ldapconn) {

    $ldapbind = ldap_bind($ldapconn, $person, $password);

    if ($ldapbind) {

    	$ldaptree = "ou=users,dc=domain,dc=com";
		$justthese = array("ou", "sn", "givenname");

		$result = ldap_search($ldapconn,$ldaptree,"givenName=$person",$justthese) or die ("Error in search query: ".ldap_error($ldapconn));

		$no = ldap_count_entries($ldapconn, $result);
		echo 'Count Entries: ' . $no . '<br>';

		$info = ldap_get_entries($ldapconn, $result);
		for ($i=0; $i<$info["count"]; $i++) 
			echo $info[$i]['givenname'][0] . ' (' . $info[$i]['mail'][0] . ')';
			echo '<hr>';

    } else {
        echo "LDAP bind ".$user." failed...";


Reference: Installing LDAP on Ubuntu 12.04

SVN: Editor & Ignore List


Set SVN Text Editor

$ export SVN_EDITOR=joe

Add Directory to Ignore List

$ svn propset svn:ignore /path/to/ignore .

Ubuntu: Add sudoers user


Edit sudoers file by running joe /etc/sudoers in Ubuntu – I’m using Joe Editor.

Add users after root ALL=(ALL) ALL.

Below is the sample – I’m giving root access to two users, nasrul & mohd.salleh.


SVN: Create new SVN user in Ubuntu


sudo htpasswd /etc/subversion/passwd username
New password: *******
Re-type new password: *******
Adding password for user username

OS: Ubuntu 12.04 LTS

Ubuntu: Zip & Unzip Directory


Zip a directory recursively

zip -r foldername

Unzip a directory

unzip -d destination_folder

SVN: Create New Repository in Ubuntu


Check SVNParentPath at /etc/apache2/mods-available/dav_svn.conf

Go to the [SVNParentPath]:

$ cd [SVNParentPath]

Create the project directory:

$ sudo mkdir myproject

The SVN repository can be created using the following command:

$ sudo svnadmin create [SVNParentPath]/myproject

And use the following commands to correct file permissions:

$ cd [SVNParentPath]
$ sudo chown -R www-data:subversion myproject
$ sudo chmod -R g+rws myproject

Ubuntu: ZIP a Folder Recursively


Run command sudo apt-get install zip in termintal to install the zip.

Then run zip -r foldername command to zip a folder recursively.