Making Laravel Passport work with Lumen

Copy from https://github.com/dusterio/lumen-passport and https://github.com/dusterio/lumen-passport/issues/136 You need to create a config file for auth services as config/auth.php: <?php return [ ‘defaults’ => [ ‘guard’ => ‘api’, ‘passwords’ => ‘users’, ], ‘guards’ => [ ‘api’ => [ ‘driver’ => ‘passport’, ‘provider’ => ‘users’, ], ], ‘providers’ => [ ‘users’ => [ ‘driver’ => ‘eloquent’, ‘model’ => \App\User::classContinue reading “Making Laravel Passport work with Lumen”

proc_open(): fork failed – Cannot allocate memory

As composer troubleshooting guide here This could be happening because the VPS runs out of memory and has no Swap space enabled. free -m To enable the swap you can use for example: sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo /sbin/mkswap /var/swap.1 sudo /sbin/swapon /var/swap.1       https://stackoverflow.com/questions/18116261/php-composer-update-cannot-allocate-memory-error-using-laravel-4

Laravel 5 – Remove public from URL

By: KA_lin Renaming the server.php to index.php (no modifications) Copy the .htaccess from public (like rimon.ekjon said below) Changing .htaccess it a bit as follows for statics: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-fContinue reading “Laravel 5 – Remove public from URL”

htaccess in yii2 basic app

By: http://www.codematrics.com/ .htaccess is a configuration file, by which apache can handle redirects which are not written in php code. So for e.g.  if you want to redirect your users to specific page when 404 error comes, you can do it with a line of code in .htaccess file. In Yii2 basic app, if you have chose prettyContinue reading “htaccess in yii2 basic app”

Yii2 htaccess – How to hide frontend/web and backend/web COMPLETELY

By: mohit   Step 1 Create .htaccess file in root folder, i.e advanced/.htaccess and write below code. Options +FollowSymlinks RewriteEngine On # deal with admin first RewriteCond %{REQUEST_URI} ^/(admin) <—— RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/ <—— RewriteCond %{REQUEST_URI} ^/(admin) <—— RewriteRule ^.*$ backend/web/index.php [L] RewriteCond %{REQUEST_URI} ^/(assets|css) <—— RewriteRule ^assets/(.*)$Continue reading “Yii2 htaccess – How to hide frontend/web and backend/web COMPLETELY”

Error 500 and 404 when using .htaccess for removing index.php

By: Sochinda Enable mod_rewrite in apache Enable ReWrite mode in Apache2 $ sudo a2enmod rewrite $ sudo service apache2 restart Edit site-enable configuration <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> Add .htaccess Options +FollowSymLinks IndexIgnore */* <IfModule mod_rewrite.c> RewriteEngine on #RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRuleContinue reading “Error 500 and 404 when using .htaccess for removing index.php”

Installing the PHP mcrypt extension on OSX 10.9

By:  Jens segers on Nov 05 2013 The following steps will explain you how to install the mcrypt extension for the default PHP version (5.4.24) that is shipped with OSX Mavericks. You need this extension for stuff like Laravel and phpMyAdmin. Otherwise you will get this error: Mcrypt PHP extension required. Step 1: Install autoconfContinue reading “Installing the PHP mcrypt extension on OSX 10.9”

Faceted navigation in PHP and MySQL

By: mightywebdeveloper.com In this tutorial we are going to build a simple PHP/MySQL faceted navigation from scratch. In case you don’t know what faceted navigation is (or faceted search, layered navigation), it’s the nice filtering mechanism you see on most e-commerce sites in some form or another next to the product listing (see image). With eachContinue reading “Faceted navigation in PHP and MySQL”

Install Apache + PHP + MySQL in Ubunut

We can Install Apache, PHP and MySQL in Ubuntu 3 types as bellow: When install Ubuntu Screen, please select ( [x] LAMP SERVER) Go to terminal : sudo apt-get install lamp-server^ Install all application one by one as:   1 Preliminary Note In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings mightContinue reading “Install Apache + PHP + MySQL in Ubunut”

Yii: use ajax function via htmlOptions attribute

By: lars If you want to trigger an ajax call on a Yii form element onchange, you can pass an array of ajax attributes as one of the “htmlOptions” like so: <?php echo $form->textField($model,’my_input_field’,array( ‘ajax’ => array( ‘type’=>’POST’, //request type ‘url’=>$this->createUrl(‘site/ajaxAction’), // url to call controller action ‘success’=>’ function(data) { $(\’#my_output_field\’).val(data) }’,// function to callContinue reading “Yii: use ajax function via htmlOptions attribute”