The connection is not made to the database , check if the database server is running or not . often this is the main cause to this issue .
Code Snippets and Programming Tasks that I need in my usual Work
Friday, December 12, 2014
Monday, July 14, 2014
Laravel unserialize(): Error at offset 0 of 399 bytes
Reset Session in your browser .
Remove Cookies from your browser
Delete View Cached files from /app/storage/sessions.
Remove Cookies from your browser
Delete View Cached files from /app/storage/sessions.
Thursday, June 26, 2014
Expected response code 220 but got code "500", with message "500 Command unrecognised ,smtp4dev, laravel
This is happened when I used to send emails from laravel application to a local Dummy smtp server (smtp4dev) that reside on my local system (windows) .
to solve this issue I found the solution is to comment the encryption option in app/mail.php and in smtp4dev server options .
to solve this issue I found the solution is to comment the encryption option in app/mail.php and in smtp4dev server options .
Saturday, May 31, 2014
Laravel ErrorException Undefined property: Illuminate\Database\Eloquent\Collection
When Using ->get() in your eloquent query like this :
Here you need to use a query that retrieve only the single row from the database ,like this :
User::where('userid',$userid)->get();
You are asking the database to bring all the users with the same userid and the result is a collection of results, So you need to go through all the results using foreach, even you know that in your database there is a unique user with such an id you will get a collection .
Here you need to use a query that retrieve only the single row from the database ,like this :
User::where('userid',$userid)->first();
Saturday, April 26, 2014
php laravel 4 "You need to specify a file path to store the seed.
This Error happened because your php version is not loading the openssl extension , check the php.ini file and un-comment this line :
to be like this :
;extension=php_openssl.dll
to be like this :
extension=php_openssl.dll
Friday, April 25, 2014
phpPgAdmin - postgres - error "Login disallowed for security reasons"
PhpPgAdmin by default deny access for certain usernames (pgsql, postgres, root, administrator) , Also it will block any attempt to login using no password .
The line controlling this is in the config.inc.php file
The line controlling this is in the config.inc.php file
$conf['extra_login_security'] = true;If you are developing a website locally you can change this option in config.inc.php file to false but keep in mind that this option is a very good security helper if you are in production phase.
Saturday, March 29, 2014
pg_ctl.exe error code 1057 on windows 7 -- PostgreSQL create user create password
The Problem is : Postgres is running on Wamp but cannot connect to database because the username is not set, or the rule is not set. So when trying to run pg_ctl.exe with -U option to change the username I got this error .
This is a windows error code :
That means the account name or the username that was used with this command is invalid , and that because (in my case) I didn't create user , to do so :
go to the PostgreSQL bin folder and run this command :
you will be prompted by password enter
Enter the password related to the account with username (postgres).
Now you have created a username `postgres` with a password , a credentials that you can use to login to PostgreSQL server.
pg_ctl.exe error code 1057
This is a windows error code :
Error code 1057: ERROR_INVALID_SERVICE_ACCOUNT - The account name is invalid or does not exist.
That means the account name or the username that was used with this command is invalid , and that because (in my case) I didn't create user , to do so :
go to the PostgreSQL bin folder and run this command :
createuser --password postgres
you will be prompted by password enter
password:
Enter the password related to the account with username (postgres).
Now you have created a username `postgres` with a password , a credentials that you can use to login to PostgreSQL server.
Sunday, March 16, 2014
in Wamp PHP Startup: Unable to load dynamic library c:\php\
If you are using Wamp server, and when you try to switch between php versions or trying to swirch between Apache versions and you get an error message saying that Php cannot load the dynamic library that you know it is exist in the extensions folder. and the stupid wamp server looking for that extension in a place other than the one mentioned in phpForApache.ini file.
The Problem here is that php-win.exe running without depending on apache server, So php will use the php.ini file that reside in php folder not the one that reside in Apache folder .
Because I didn't change this file (the one in php folder) and used to deal with phpForApache.ini because it is the one that will be copied to Apache folder .
To solve this issue just make the two files identical , that means when you make any changes to one of the be assure that you make these vhanges in the other one.
The Problem here is that php-win.exe running without depending on apache server, So php will use the php.ini file that reside in php folder not the one that reside in Apache folder .
Because I didn't change this file (the one in php folder) and used to deal with phpForApache.ini because it is the one that will be copied to Apache folder .
To solve this issue just make the two files identical , that means when you make any changes to one of the be assure that you make these vhanges in the other one.
Friday, March 14, 2014
Add a new version of PHP to Wamp Server
To Add a new version of PHP to wamp server , Say you have php5.4.3 and you want to add a new version php5.5.8.
You have to follow these steps to be assure that you can run the new version in your wamp server :
1. Copy the new php version folder to the php folder in Wamp/bin folder .
Example :
Wamp/bin/php/
/php5.4.3
/php5.5.8
(Note: the first number must be attached directly to php, no space no dots) .
2.Create a new file and name it
3.Copy the content of the
4.make a copy of
5. (if it is not Exist)Add the following line to the new
6. Add the following line to the end of the LoadModule section in httpd.conf file which reside in wamp/bin/apache/apache2.4.*/:
7.Also add the following line :
(Note: these two line will be replaced by the contents in the
You have to follow these steps to be assure that you can run the new version in your wamp server :
1. Copy the new php version folder to the php folder in Wamp/bin folder .
Example :
Wamp/bin/php/
/php5.4.3
/php5.5.8
(Note: the first number must be attached directly to php, no space no dots) .
2.Create a new file and name it
wampserver.conf
in the new php folder(php5.5.8) .3.Copy the content of the
wampserver.conf
that reside in the last php version (php5.4.3) to the wampserver.conf
of the new php version(php5.5.8).4.make a copy of
php.ini
file in the new php version(5.5.8) folder and name it phpForApache.ini
.5. (if it is not Exist)Add the following line to the new
phpForApache.ini
: extension_dir = "d:/wamp/bin/php/php5.5.8/ext/"
.6. Add the following line to the end of the LoadModule section in httpd.conf file which reside in wamp/bin/apache/apache2.4.*/:
LoadModule php5_module "d:/wamp/bin/php/php5.5.8/php5apache.dll".
7.Also add the following line :
;AddModule php5
(Note: these two line will be replaced by the contents in the
wampserver.conf
variables ,So it is not important what is written here as long as the line contain the two words "LoadModule" and "php" or "AddModule" and "php").
Thursday, March 6, 2014
Task 'default' was not defined in your gulpfile but you tried to run it Please check the documentation for proper gulpfile formatting.
Task 'default' was not defined in your gulpfile but you tried to run it Please check the documentation for proper gulpfile formatting.
This error happened when I was trying to minify a CSS file which was including @media tags ,I was trying to minify this file using Notepad++ Jstool plugin through JsMin command, but the this function cannot handle @media queries the right way and the output file will not maintain @media queries properly and the final Css file will be useless. So to solve this issue I had to install gulp and its gulp-minify-css plugin because But when I created the gulpfile like this :
and tried to run the command :
I got the above mentioned error ,So I thought the problem because I didn't add the file name to the command :
but that also didn't solve the issue. again and again I check the file for syntax errors but didn't find thing.
The problem as very dummy . It is because I didn't add the task name to the command line :
That's it . thank you.
This error happened when I was trying to minify a CSS file which was including @media tags ,I was trying to minify this file using Notepad++ Jstool plugin through JsMin command, but the this function cannot handle @media queries the right way and the output file will not maintain @media queries properly and the final Css file will be useless. So to solve this issue I had to install gulp and its gulp-minify-css plugin because But when I created the gulpfile like this :
var gulp = require('gulp'); var minifyCSS = require('gulp-minify-css'); gulp.task('minify-css', function() { gulp.src('styles.css') .pipe(minifyCSS()) .pipe(gulp.dest('./')); });
and tried to run the command :
gulp
I got the above mentioned error ,So I thought the problem because I didn't add the file name to the command :
gulp gulpfile.js
but that also didn't solve the issue. again and again I check the file for syntax errors but didn't find thing.
The problem as very dummy . It is because I didn't add the task name to the command line :
gulp minify-css
That's it . thank you.
Wednesday, January 29, 2014
Call to undefined method Illuminate\Foundation\Providers\ArtisanServiceProvider::when()
This error showed when trying to upgrade to Laravel 4.1, Also when trying to update composer , the first Solution to this problem is to change all your composer.json file (assumed that you have some in workbench folder), to be compatible with new versions of laravel :
Change this line in Composer.json :
to be Like this
Then Run :
In the main folder that contain composer.json And also on all the main folders of your packages .
Change this line in Composer.json :
"illuminate/support": "4.1.*"
to be Like this
"illuminate/support": "4.*"
Then Run :
Composer update --no-scripts
In the main folder that contain composer.json And also on all the main folders of your packages .
Subscribe to:
Posts (Atom)