I saw this error when I tried to install Linux (Cent OS) environment to run Laravel 5.3
Here is the fastest solution that I found :)
Edit your php.ini, add ":/dev/urandom:/dev/random" at the end of open_basedir info to allow php can execute into these folders
open_basedir = "/tmp:/u01/ottportal/cms/:/u01/ottportal/env/php/:/dev/urandom:/dev/random"
HỌC Laravel Framework
Từng bước học Laravel Framework
Wednesday, March 29, 2017
Tuesday, March 28, 2017
Laravel how to create a custom Artisan Console Command
My project need a report function which run every 30 minutes.
And, here is my solution for this task: Using Artisan Console Command, combine with Linux's crontab.
1. Prepare:
- Set php environment (optional)
- Laravel 5.x
- Allow your account can run "crontab" function
2. Create a custom Console command: GeneralReport
This command will generate a class with name "GeneralReportCommand" in folder /your/project/path/app/Console/Commands/
And, here is my solution for this task: Using Artisan Console Command, combine with Linux's crontab.
1. Prepare:
- Set php environment (optional)
- Laravel 5.x
- Allow your account can run "crontab" function
2. Create a custom Console command: GeneralReport
cd /your/project/path/
php artisan make:command GeneralReportCommand
This command will generate a class with name "GeneralReportCommand" in folder /your/project/path/app/Console/Commands/
Monday, August 8, 2016
How to set cookie in controller with Laravel 5
It's not easy to do. I've tried to find on Google, and saw many people had the same question with me.
And here is a good information for you:
Test:
And here is a good information for you:
use Cookie;
use Illuminate\Http\Request;
class DefaultController extends \App\Http\Controllers\Controller
{
/**
* Home page
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function home(Request $request)
{
$test = Cookie::make('test_cookie1', 'cookie1 value', 60);
$response = new \Illuminate\Http\Response(view('frontend.default.home', ['test' => 'send to template']));
// Set 2 cookie
$response->withCookie(cookie('test_cookie2', $request->referrer, 45000))
->withCookie($test);
return $response;
}
}
Test:
Monday, March 14, 2016
Tạo form contact với Laravel
Hướng dẫn tạo Form Contact đơn giản với Laravel
Laravel + Bảng contact + cấu hình kết nối tới database
CREATE TABLE `tld_contact` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`subject` varchar(255) NOT NULL,
`content` text,
`is_read` tinyint(1) NOT NULL DEFAULT '0',
`fullname` varchar(100) NOT NULL COMMENT 'ho ten nguoi gui lien he',
`email` varchar(255) NOT NULL,
`phone_number` varchar(15) DEFAULT NULL,
`address` varchar(15) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`product_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
1. Tạo controller
php artisan make:controller --plain Frontend\ContactController
Hàm này sẽ giúp tạo ra 1 controller: app\Http\Controllers\Frontend\ContactController.phpVới đầy đủ các hàm có thể tương tác với 1 đối tượng: index, create, store, edit, show, edit, destroy
Ở đây sẽ dùng đến 2 hàm: create & store để xử lý việc hiển thị form contact và xử lý lưu contact vào DB
Tuesday, February 16, 2016
Laravel Oracle with OCI 8
Kết nối Oracle database với OCI 8
1. Cài đặt package yajra/laravel-oci8
cd /path/to/project-name/
composer require yajra/laravel-oci8
2. Cấu hình bổ sung provider trong config/app.php
Yajra\Oci8\Oci8ServiceProvider::class
3. Publish configuration (chạy nếu cần, ko bắt buộc)
php artisan vendor:publish --tag=oracle
Laravel sẽ sinh 1 file cấu hình riêng cho oracle (config/oracle.php )
4. Configure file database: config/database.php
Thêm vào 'connections' đoạn code sau:
'oracle' => array(
'driver' => 'oracle',
'host' => '10.58.x.x',
'port' => '1521',
'database' => 'orcl',
'username' => 'laravel',
'password' => '123456',
'charset' => 'AL32UTF8',
'prefix' => '',
)
5. Done.
Tham khảo: https://github.com/yajra/laravel-oci8/wiki/Installation
Nếu bạn gặp khó khăn khi enable php_oci8 trên window thì xem ở đây: Enable php_oci8.dll on window
Bài tiếp: Sử dụng cùng 1 lúc 2 kết nối sang Oracle và Mysql
1. Cài đặt package yajra/laravel-oci8
cd /path/to/project-name/
composer require yajra/laravel-oci8
2. Cấu hình bổ sung provider trong config/app.php
Yajra\Oci8\Oci8ServiceProvider::class
3. Publish configuration (chạy nếu cần, ko bắt buộc)
php artisan vendor:publish --tag=oracle
Laravel sẽ sinh 1 file cấu hình riêng cho oracle (config/oracle.php )
4. Configure file database: config/database.php
Thêm vào 'connections' đoạn code sau:
'oracle' => array(
'driver' => 'oracle',
'host' => '10.58.x.x',
'port' => '1521',
'database' => 'orcl',
'username' => 'laravel',
'password' => '123456',
'charset' => 'AL32UTF8',
'prefix' => '',
)
5. Done.
Tham khảo: https://github.com/yajra/laravel-oci8/wiki/Installation
Nếu bạn gặp khó khăn khi enable php_oci8 trên window thì xem ở đây: Enable php_oci8.dll on window
Bài tiếp: Sử dụng cùng 1 lúc 2 kết nối sang Oracle và Mysql
Wednesday, April 22, 2015
Work with Laravel ViewComposer
This video will help you to work correctly with Laravel ViewComposer
Thank laracasts.com for sharing
https://laracasts.com/series/laravel-5-fundamentals/episodes/25
Wednesday, April 1, 2015
Create folder with Laravel Filesystem
Cách tạo một cây thư mục đơn giản với Laravel Filesystem
Sử dụng hàm: File::makeDirectory()
Ví dụ:
Để tạo 1 folder với chmod default
Hoặc để tạo 1 cây thư mục với chmod 0755
Sử dụng hàm: File::makeDirectory()
Ví dụ:
Để tạo 1 folder với chmod default
$result = File::makeDirectory('/path/to/directory');
Hoặc để tạo 1 cây thư mục với chmod 0755
$result = File::makeDirectory('/path/to/directory', 0775, true);
Subscribe to:
Posts (Atom)
