Laravel routes not working

If your main Laravel page is working but no other routes are then this may be of use to you.

My doc root is here:

/var/www/html/quickstart/public

Firstly enable mod rewrite:

sudo a2enmod rewrite

Then check your routes that weren’t loading, if it works great! If not, then read on.

Edit your default apache site conf file:

sudo gedit /etc/apache2/sites-enabled/000-default.conf

Mine is below:

<VirtualHost *:80>
    ServerName localhost
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/quickstart/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory "/var/www/html/quickstart/public">
        Allowoverride All
    </Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

That worked for me on Ubuntu, hope it helps someone.

I have been trying out laravel and intend to use it for some projects in the future but I’ve been finding it very frustrating to get it installed and running. The homstead vagrant setup they have just simply doesn’t work and this is the second time I’ve tried it over the past 3 months, so it wasn’t a passing bug. I’ve only ever got laravel up and running on Linux by setting it up manually and never got it working on windows. Hopefully after a few fresh installs I’ll have it down to a few nice steps and I’ll write those up =)

Watchdog Script

I was looking  for a script to monitor a process and restart it if it failed on Linux, so here is a watch dog script that I found on SO, here: http://stackoverflow.com/a/16787862/4028210

The script will watch a process and restart it if it is not running.

The script

#!/bin/sh

PROCESS="$1"
PROCANDARGS="<YOUR PROCESS AND ARGS>"

while :
do
    RESULT=`pgrep ${PROCESS}`
    if [ "${RESULT:-null}" = null ]; then
        echo "${PROCESS} not running, starting "$PROCANDARGS
        $PROCANDARGS &
    else
         echo "running"
    fi
    sleep 10
done

 

Usage

Let’s say the script is named “wdt.sh”

make sure it is executable:

chmod +x ./wdt.sh

As an example we’ll keep gedit running, run it as below:

./wdt/sh gedit

Installing Jira on AWS

Jira is a widely used issue tracker, among other things. Below is a set of steps to get it up and running on an AWS server (Amazon’s Web Services).

NB: Do not try to install Jira on the free tier AWS servers, they are simply not powerful enough and run out of memory during installation. I found out the slow and tedious way!

Continue reading Installing Jira on AWS

Setup git Repo

Some useful reference steps for setting up your git repo. Works on both Linux and Windows command line, just note that the “touch README.md” won’t work on windows, just create a new txt file instead.

Setup your name and email

git config --global user.name "name"
git config --global user.email "blah@example.com"

Create a new repository

mkdir my-project
cd my-project
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@example.com:example/my-project.git
git push -u origin master

Push an existing Git repository

cd existing_git_repo
git remote add origin git@example.com:example/my-project.git
git push -u origin master

Installing mariadb for CentOS

Reference commands for install and setup of mysql / mariadb on red hat distros like CentOS.

The below commands install the server, enable the database service to start on boot, setup the database service and finally start the service.

yum install mariadb-server mariadb

systemctl enable mariadb.service

mysql_secure_installation

systemctl start mariadb.service

Install SVN from source

I’ve been having problems recently with SVN not being kept up to date on a company repo. So I installed SVN from source so that I could use a modern GUI.

(smartsvn has a free version which I opted to use but once it had upgraded my repos they no longer worked with the command line client – so that needed updating)

Installing from source

yum update
yum groupinstall "Development tools"
yum groupinstall "Additional Development"
wget https://archive.apache.org/dist/subversion/subversion-1.8.9.tar.gz
tar zxvf subversion-1.8.9.tar.gz
cd subversion-1.8.9
./get-deps.sh
./configure
make
make check
sudo make install

If APR and APRUTIL cannot be found

If you find that it complains about APR and APRUTIL missing during the configure command then run this line instead:

./configure --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr/

Test internet connectivity from bash script

Ensure you have curl installed and then you can use the following bash code in your scripts to test for internet connectivity.

 

#!/bin/bash

echo "Testing connection..."

curlOutput=$(curl -I http://google.com)

# Possible cases, there are more but here we cover:
# 407 which can mean bad proxy details,
# 200 which means everything is OK,
# 302 which is a redirection but for us that's OK too.

if [[ $curlOutput == *"407"* ]]
then
 echo "No internet connection, bad proxy username / password";
 return
fi

if [[ $curlOutput == *"200"* ]]
then
 echo "internet connection OK";
 return
fi

if [[ $curlOutput == *"302"* ]]
then
 echo "internet connection OK";
 return
fi

 

Enjoy 🙂