| |

Laravel Jenkins CI

This article covers installation of Jenkins on Ubuntu server and its usage to continuously integrate a Laravel application.  Besides LAMP/LEMP stack we need to install Java, Git, Composer, and Node to successfully use Jenkins. Before starting to install this software, let’s take care of miscellaneous  stuff. Miscellaneous (can skip this). Create mysql user and database….

Laravel: Getting Authenticated User Early in the Controller

Sometimes there is a need to access the authenticated user in your controller.  If you do it in several methods in your controller, it makes sense to put the code in the constructor.  Unfortunately, the code below will not work. This happens because the request is not injected into the controller at the time of…

|

Composer: Path Repositories

When working on a php package it is inconvenient to push the package to github (or other repository) and then wait for the package to update using composer update.  For package development, composer has such feature as path repositories.  Let’s imagine we have a two folders on the same level:  my-app and  package.   my-app is an app — a test…

|

Adding Virtual Box Bridged Network Adapter to Laravel Homestead

Vagrant allows you to configure bridged network adapter, so your vagrant(homestead) box can be seen on local network.  I order to make this possible by adding a line of code to homestear.rb script in scripts folder. I opted to add this line after the following code. 25 26 27 28 29 if settings.has_key?("networks") settings["networks"].each do |network| config.vm.network…

|

Running Artisan Command as a Separate PHP Process in Laravel

In Laravel framework you can create commands and call them from php application.  One command can call another command, and another command, and so on.  But if an exception is thrown in one of the commands in this chain the whole chain breaks.  In order to avoid this problem and run each artisan command as…

|

Create WordPress User with Admin Privileges in MySQL

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES (’admin’, MD5(’password’), ‘User Admin’, ‘user@admin.com’, ‘0’);   INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (SELECT MAX(id) FROM wp_users), ‘wp_capabilities’, ‘a:1:{s:13:"administrator";s:1:"1";}’);   INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (SELECT MAX(id) FROM wp_users), ‘wp_user_level’, ’10’);INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES…

Disable .htaccess on Apache

It is possible to disable .htaccess files while using mod_rewrite in virtual host’s configuration file. <Directory /home/vagrant/blog/public> Options FollowSymLinks AllowOverride None Require all granted <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> </Directory> <Directory /home/vagrant/blog/public> Options FollowSymLinks AllowOverride None Require all granted…

Running Node.js App with Supervisord on Homestead

Earlier I covered how to continuously run Node.js app with Forever.  In this article I will explain how to run Node.js app with Supervisord.  Since Homestead already has Supervisord installed, we will use it. First, let’s create a simple node application.  Edit after.sh script in Homestead installation to contain the following code: #!/bin/sh cd /var/www…