In development just change session to file. (used to be the default).
Problem creating Laravel project, Laravel installed on WAMPserver
I followed the procedure shown in this video by Dani Krossing titled: 2 | How to Easily Install Laravel | Laravel for Complete Beginners | Laravel Tutorial. https://www.youtube.com/watch?v=iBaM5LYgyPk
Everything went well until 23:30 where my database only has the "migrations" and "users" tables. I am using WAMPserver, have been for a few years now, where he has "DASHBOARD" I have "laravel" and where he has "firstwebsite" I have "prj01". I'm using PHP 8.3.6, and MySQL 8.3.0 and Apache 2.4.59. I created the local host "prj01" pointing to the "laravel/prj01/public" folder and when I click on it I get the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'prj01.sessions' doesn't exist (Connection: mysql, SQL: select * from `sessions` where `id` = ...omitted... limit 1)
The "sessions" table was not created nor all the other tables shown at 23:30. I've deleted everything and redid all a few times, same results every time. Why are all the other tables not being created. It obviously has access to the "prj01" table because it creates the "migrations" and "users" tables.
@jlrdw Thanks you for your reply, however, I'm new to Laraval, I don't know what you mean by "In development". Will this fix the problem so that all new projects I create as shown at 20:30 of his video this problem will not occur? Note: This system will not allow me to post links my first day here, otherwise I would have given the link to his video.
@jlrdw Hmmm, it appears that at best you skimmed my first post without picking up important details such as "I'm using PHP 8.3.6, and MySQL 8.3.0 and Apache 2.4.59" and "have been for a few years now" except of course that the versions were earlier versions. "In development" does not tell me where to "change session to file." As I said "I'm new to Laraval", just heard a lot of good things about it so thought I'd give it a try. As far as Laravel is concerned, it does not know whether it is XAMP or WAMP. The command executed in the "laravel" directory: "laravel new prj01" obviously executed its code via PHP 8.3.6 and in the "prj01" database it created two tables "migrations" and "users", and it created the "prj01" directory in the "laravel" directory and filled that directory with all the things it is supposed to according to the aforementioned video (still won't let me post a link to the video) as seen at time index: 25:09. The problem I encountered has nothing to do with my PHP programming skills, I've been programming in PHP for several years. So, again, why did "laravel" (the PHP code developed by the Laravel team) not create all the other tables in the "prj01" database as seen in said video at time index 23:30? It only created the two tables "migrations" and "users". When I click to load the (laravel/prj01/index.php) into the browser I get the aforementioned error that it cannot find the "sessions" table. Why was it and several other tables not created when it created the "migrations" and "users" tables? I should not have to debug Laravel's PHP code? The only material difference between the system being used in the video and mine is that my version of Laravel may be newer. My PHP version and MySQL versions are newer. However, not that much newer. And as I said before: "I followed the procedure shown on this video by Dani Krossing titled: 2 | How to Easily Install Laravel | Laravel for Complete Beginners | Laravel Tutorial. Everything went well until 23:30" I really hope you don't simply skim this post and make more erroneous assumptions and therefore erroneous assertions/comments/suggestions.
@jlrdw Let's see:
- My first post I state: "I'm using PHP 8.3.6, and MySQL 8.3.0 and Apache 2.4.59."
- One of your replies to said post: "I suggext Mysql and either Apache or Nginx for development."
I told you I'm using MySQL and you then suggest that I use MySQL. I told you I'm using Apache and you then suggest that I use Apache.
- You say: "But as @puklipo said, I suggest taking the free php course first if new to all of this."
"@puklipo" never suggested such, however "@Tray2" gave me a link to such a course, which I'm half way through.
Don't use weird videos made by beginners as a reference.
This video is completely different from how advanced users use Laravel. https://www.youtube.com/watch?v=iBaM5LYgyPk
- If you are using Windows, first install WSL. Throw away XAMPP etc.
- Install PHP and composer on Ubuntu in WSL.
- Install
laravel/installer. - Create a Laravel project.
The default server as of Laravel 11 is php artisan serve and the database is SQLite.
If you can't understand this explanation, you need to learn the basics of PC and PHP before Laravel. Laravel is not for beginners. Don't jump straight into Laravel.
Why use a wamp server? User Laravel Herd!
@shaungbhone I have a few projects in WAMPserver and have no problems with it. I'm used to it and I prefer not to have yet another development system. Not all my projects will be laravel, will "Herd" only allow laravel projects? Have you used WAMP or XAMP and if so, what are the benefits of "Herd" over "WAMP"?
@rfm Explore yourself. Trust me Herd is better.
@shaungbhone Sorry, I never trust anyone that says "trust me", especially when they cannot tell me why, such as "what are the benefits of 'Herd' over 'WAMP'?", which probably means you never used WAMP, at least sufficiently enough, and therefore don't know why you believe "Herd" is better than "WAMP". This makes you appear as a promoter of a product you may financially benefit from.
This is the best place to start with Laravel
https://laracasts.com/series/30-days-to-learn-laravel-11
You should use Herd for your local development, it's by far the easiest, it gives you everything you need as long as you use SQlite database, and as a beginner who is learning it's good enough. Herd is a first party application from Larvel and Beyond Code.
If you feel that you need another database, I suggest getting dbnging, it makes it super easy to spin up different versions of the database.
@Tray2 Thank you for your reply. I'm now half way through "30-days-to-learn-laravel-11". Laravel seems to be as good as I've heard and read about. The only thing I'm learning is Laravel. My first paid for software engineering job was in 1976 when I developed an accounting package (GL, AR, AP, PR, INV) in machine code, 0s and 1s for an accountant who used it for a few years until he hired me to find him a multi-user computer system and program an accounting package to run on it, which I did. I have programmed in over 30 programming languages, packages such as Accounting for accountants/CPAs/bookkeepers, Electric billing for electricity providers, Gas flow analysis natural gas supply companies, Timber management for timber companies, Retaining walls for retaining wall engineers, Costume jewelry POS and INV management for costume jewelry stores, Websites using PHP HTML CSS JS etc., and numerous others. I've always been one to not use platforms because I prefer to know exactly what is going on everywhere. Laravel interested me, so thought I'd look into it. I've never had such difficulty getting something up and running as Laravel. I have yet to see why "Herd" is better than "WAMP". As far as "DBngin" goes, with "WAMP" I can easily switch and use different databases and versions of said database as well as different versions of PHP. I haven't seen any reason to switch from "WAMP" as of yet, I may come across one in the future, who knows.
@rfm Wamp works perfectly fine, but with Herd you get a an easy way to use multiple versions of php, and node on a per project bases, and with zero configuration you get custom domains for each of your projects, simply just create an new project folder in you Herd directory, and you have that directory name dot test available.
- laravel new blog / composer create-project laravel/laravel blog
- visit blog.test
The reason I suggested using dbngin is that you can easily spin up a new database server within seconds. You need a Redis server version 3, or perhaps 4, 5, 6, or 7, or maybe you need a MySQL 5.7, or a more recent version 8 for a project, or another client might want Postgreesql, well you just spin up an instance of of that. You can basically have as many servers running as you need.
@Tray2 I have installed DBngin to see what it does. It seems to be a great solution. Would be nice if it would run with WAMPserver, can't find anything on the internet addressing that possibility.
So, when using Herd, the (name of the project).test in the browser address bar will load the initial page "(name of the project).public.index.php"? Does Herd change the "C:\Windows\System32\drivers\etc\hosts" file to accomplish that?
I know what the "laravel new blog" does, but I do not know what you mean by "composer create-project laravel/laravel blog", is this creating a project "laravel blog" in the "laravel" directory? Or perhaps creating a "blog" project in a created directory "laravel" within a directory "laravel"?
Last week I finished the "30-days-to-learn-laravel-11" course, when time allows I'll do it again but this time I'll follow along by doing it in my project as well since I am now able to create new projects without errors.
@rfm Herd + DBNgin is what you should use together, if you use wamp, then you already have everything installed. It works but it's no where near as good as Herd + DBNgin.
there are 2 options, first option: in the .env file change session driver from database to file like this: SESSION_DRIVER=file
second option: if you want to use session driver database you should create the migration and run it with this artisan commands:
php artisan make:session-table php artisan migrate
@acuarelasoft Thank you for your reply. Finally one that doesn't make assumptions. When I run: "laravel --version" it replies with "Laravel Installer 5.8.3", which should be the most recent one as of a few days ago.
- What driver does this version recommend: database or file?
- What is the benefit of "file" over "database"?
- For all the other tables that were not created in the "prj01" database, will I have to "php artisan make:(table name)-table php artisan migrate"?
I'd still like to know why it worked on his system on the video and not mine, any idea?
@rfm instead run php artisan -v if you want to know what version you are on
run php artisan db:show to see what database Laravel thinks it is working with.
@Snapey Hello:
php artisan -v returns among other things: Laravel Framework 11.22.0
php artisan db:show returns among other things: MySQL ... 8.3.0
@rfm you dont have to pay per line of text posted here. I was hoping to see your database name and table names
@Snapey I did give the information you requested. Following is lots of details:
========================================
C:\wamp64\www\laravel>dir
Volume in drive C is Acer
Volume Serial Number is 9CE7-F03B
Directory of C:\wamp64\www\laravel
09/11/2024 10:25 AM <DIR> .
09/12/2024 03:00 PM <DIR> ..
09/11/2024 10:26 AM <DIR> prj01
0 File(s) 0 bytes
3 Dir(s) 223,875,321,856 bytes free
========================================
C:\wamp64\www\laravel\prj01>php artisan -v
Laravel Framework 11.22.0
Removed the rest since it is simply instructions.
========================================
C:\wamp64\www\laravel\prj01>php artisan db:show
MySQL ........................................................................................................ 8.3.0
Connection ................................................................................................... mysql
Database ..................................................................................................... prj01
Host ..................................................................................................... 127.0.0.1
Port .......................................................................................................... 3306
Username ...................................................................................................... root
URL ................................................................................................................
Open Connections ................................................................................................. 1
Tables ........................................................................................................... 2
Total Size ................................................................................................. 2.00 KB
Table ......................................................................................................... Size
migrations ................................................................................................. 1.00 KB
users ...................................................................................................... 1.00 KB
========================================
I have deleted the "prj01" directory:
C:\wamp64\www\laravel>dir
Volume in drive C is Acer
Volume Serial Number is 9CE7-F03B
Directory of C:\wamp64\www\laravel
09/15/2024 07:16 AM <DIR> .
09/12/2024 03:00 PM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 223,979,335,680 bytes free
========================================
I DROPped the "prj01" database
MySQL:3306/ http://localhost/phpmyadmin/index.php?route=/server/sql Your SQL query has been executed successfully.
show databases;
information_schema
mysql
performance_schema
sys
========================================
I will now create a new project and capture the command output:
C:\wamp64\www\laravel>laravel new prj01
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
Would you like to install a starter kit? [No starter kit]:
[none ] No starter kit
[breeze ] Laravel Breeze
[jetstream] Laravel Jetstream
> none
Which testing framework do you prefer? [Pest]:
[0] Pest
[1] PHPUnit
> 0
Would you like to initialize a Git repository? (yes/no) [no]:
> no
Creating a "laravel/laravel" project at "./prj01"
Installing laravel/laravel (v11.2.0)
- Downloading laravel/laravel (v11.2.0)
- Installing laravel/laravel (v11.2.0): Extracting archive
Created project in C:\wamp64\www\laravel/prj01
Loading composer repositories with package information
Updating dependencies
Lock file operations: 106 installs, 0 updates, 0 removals
- Locking brick/math (0.12.1)
- Locking carbonphp/carbon-doctrine-types (3.2.0)
- Locking dflydev/dot-access-data (v3.0.3)
- Locking doctrine/inflector (2.0.10)
- Locking doctrine/lexer (3.0.1)
- Locking dragonmantank/cron-expression (v3.3.3)
- Locking egulias/email-validator (4.0.2)
- Locking fakerphp/faker (v1.23.1)
- Locking filp/whoops (2.15.4)
- Locking fruitcake/php-cors (v1.3.0)
- Locking graham-campbell/result-type (v1.1.3)
- Locking guzzlehttp/guzzle (7.9.2)
- Locking guzzlehttp/promises (2.0.3)
- Locking guzzlehttp/psr7 (2.7.0)
- Locking guzzlehttp/uri-template (v1.0.3)
- Locking hamcrest/hamcrest-php (v2.0.1)
- Locking laravel/framework (v11.23.5)
- Locking laravel/pint (v1.17.3)
- Locking laravel/prompts (v0.1.25)
- Locking laravel/sail (v1.32.0)
- Locking laravel/serializable-closure (v1.3.4)
- Locking laravel/tinker (v2.9.0)
- Locking league/commonmark (2.5.3)
- Locking league/config (v1.2.0)
- Locking league/flysystem (3.28.0)
- Locking league/flysystem-local (3.28.0)
- Locking league/mime-type-detection (1.15.0)
- Locking mockery/mockery (1.6.12)
- Locking monolog/monolog (3.7.0)
- Locking myclabs/deep-copy (1.12.0)
- Locking nesbot/carbon (3.8.0)
- Locking nette/schema (v1.3.0)
- Locking nette/utils (v4.0.5)
- Locking nikic/php-parser (v5.1.0)
- Locking nunomaduro/collision (v8.4.0)
- Locking nunomaduro/termwind (v2.1.0)
- Locking phar-io/manifest (2.0.4)
- Locking phar-io/version (3.2.1)
- Locking phpoption/phpoption (1.9.3)
- Locking phpunit/php-code-coverage (11.0.6)
- Locking phpunit/php-file-iterator (5.1.0)
- Locking phpunit/php-invoker (5.0.1)
- Locking phpunit/php-text-template (4.0.1)
- Locking phpunit/php-timer (7.0.1)
- Locking phpunit/phpunit (11.3.5)
- Locking psr/clock (1.0.0)
- Locking psr/container (2.0.2)
- Locking psr/event-dispatcher (1.0.0)
- Locking psr/http-client (1.0.3)
- Locking psr/http-factory (1.1.0)
- Locking psr/http-message (2.0)
- Locking psr/log (3.0.2)
- Locking psr/simple-cache (3.0.0)
- Locking psy/psysh (v0.12.4)
- Locking ralouphie/getallheaders (3.0.3)
- Locking ramsey/collection (2.0.0)
- Locking ramsey/uuid (4.7.6)
- Locking sebastian/cli-parser (3.0.2)
- Locking sebastian/code-unit (3.0.1)
- Locking sebastian/code-unit-reverse-lookup (4.0.1)
- Locking sebastian/comparator (6.1.0)
- Locking sebastian/complexity (4.0.1)
- Locking sebastian/diff (6.0.2)
- Locking sebastian/environment (7.2.0)
- Locking sebastian/exporter (6.1.3)
- Locking sebastian/global-state (7.0.2)
- Locking sebastian/lines-of-code (3.0.1)
- Locking sebastian/object-enumerator (6.0.1)
- Locking sebastian/object-reflector (4.0.1)
- Locking sebastian/recursion-context (6.0.2)
- Locking sebastian/type (5.0.1)
- Locking sebastian/version (5.0.1)
- Locking symfony/clock (v7.1.1)
- Locking symfony/console (v7.1.4)
- Locking symfony/css-selector (v7.1.1)
- Locking symfony/deprecation-contracts (v3.5.0)
- Locking symfony/error-handler (v7.1.3)
- Locking symfony/event-dispatcher (v7.1.1)
- Locking symfony/event-dispatcher-contracts (v3.5.0)
- Locking symfony/finder (v7.1.4)
- Locking symfony/http-foundation (v7.1.3)
- Locking symfony/http-kernel (v7.1.4)
- Locking symfony/mailer (v7.1.2)
- Locking symfony/mime (v7.1.4)
- Locking symfony/polyfill-ctype (v1.31.0)
- Locking symfony/polyfill-intl-grapheme (v1.31.0)
- Locking symfony/polyfill-intl-idn (v1.31.0)
- Locking symfony/polyfill-intl-normalizer (v1.31.0)
- Locking symfony/polyfill-mbstring (v1.31.0)
- Locking symfony/polyfill-php80 (v1.31.0)
- Locking symfony/polyfill-php83 (v1.31.0)
- Locking symfony/polyfill-uuid (v1.31.0)
- Locking symfony/process (v7.1.3)
- Locking symfony/routing (v7.1.4)
- Locking symfony/service-contracts (v3.5.0)
- Locking symfony/string (v7.1.4)
- Locking symfony/translation (v7.1.3)
- Locking symfony/translation-contracts (v3.5.0)
- Locking symfony/uid (v7.1.4)
- Locking symfony/var-dumper (v7.1.4)
- Locking symfony/yaml (v7.1.4)
- Locking theseer/tokenizer (1.2.3)
- Locking tijsverkoyen/css-to-inline-styles (v2.2.7)
- Locking vlucas/phpdotenv (v5.6.1)
- Locking voku/portable-ascii (2.0.1)
- Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 106 installs, 0 updates, 0 removals
- Downloading laravel/framework (v11.23.5)
- Downloading laravel/sail (v1.32.0)
- Downloading phpunit/phpunit (11.3.5)
0/3 [>---------------------------] 0%
1/3 [=========>------------------] 33%
3/3 [============================] 100%
- Installing doctrine/inflector (2.0.10): Extracting archive
- Installing doctrine/lexer (3.0.1): Extracting archive
- Installing symfony/polyfill-ctype (v1.31.0): Extracting archive
- Installing webmozart/assert (1.11.0): Extracting archive
- Installing dragonmantank/cron-expression (v3.3.3): Extracting archive
- Installing symfony/deprecation-contracts (v3.5.0): Extracting archive
- Installing psr/container (2.0.2): Extracting archive
- Installing fakerphp/faker (v1.23.1): Extracting archive
- Installing symfony/polyfill-php83 (v1.31.0): Extracting archive
- Installing symfony/polyfill-mbstring (v1.31.0): Extracting archive
- Installing symfony/http-foundation (v7.1.3): Extracting archive
- Installing fruitcake/php-cors (v1.3.0): Extracting archive
- Installing psr/http-message (2.0): Extracting archive
- Installing psr/http-client (1.0.3): Extracting archive
- Installing ralouphie/getallheaders (3.0.3): Extracting archive
- Installing psr/http-factory (1.1.0): Extracting archive
- Installing guzzlehttp/psr7 (2.7.0): Extracting archive
- Installing guzzlehttp/promises (2.0.3): Extracting archive
- Installing guzzlehttp/guzzle (7.9.2): Extracting archive
- Installing symfony/polyfill-php80 (v1.31.0): Extracting archive
- Installing guzzlehttp/uri-template (v1.0.3): Extracting archive
- Installing laravel/pint (v1.17.3): Extracting archive
- Installing symfony/polyfill-intl-normalizer (v1.31.0): Extracting archive
- Installing symfony/polyfill-intl-grapheme (v1.31.0): Extracting archive
- Installing symfony/string (v7.1.4): Extracting archive
- Installing symfony/service-contracts (v3.5.0): Extracting archive
- Installing symfony/console (v7.1.4): Extracting archive
- Installing voku/portable-ascii (2.0.1): Extracting archive
- Installing phpoption/phpoption (1.9.3): Extracting archive
- Installing graham-campbell/result-type (v1.1.3): Extracting archive
- Installing vlucas/phpdotenv (v5.6.1): Extracting archive
- Installing symfony/css-selector (v7.1.1): Extracting archive
- Installing tijsverkoyen/css-to-inline-styles (v2.2.7): Extracting archive
- Installing symfony/var-dumper (v7.1.4): Extracting archive
- Installing symfony/polyfill-uuid (v1.31.0): Extracting archive
- Installing symfony/uid (v7.1.4): Extracting archive
- Installing symfony/routing (v7.1.4): Extracting archive
- Installing symfony/process (v7.1.3): Extracting archive
- Installing symfony/polyfill-intl-idn (v1.31.0): Extracting archive
- Installing symfony/mime (v7.1.4): Extracting archive
- Installing psr/event-dispatcher (1.0.0): Extracting archive
- Installing symfony/event-dispatcher-contracts (v3.5.0): Extracting archive
- Installing symfony/event-dispatcher (v7.1.1): Extracting archive
- Installing psr/log (3.0.2): Extracting archive
- Installing egulias/email-validator (4.0.2): Extracting archive
- Installing symfony/mailer (v7.1.2): Extracting archive
- Installing symfony/error-handler (v7.1.3): Extracting archive
- Installing symfony/http-kernel (v7.1.4): Extracting archive
- Installing symfony/finder (v7.1.4): Extracting archive
- Installing ramsey/collection (2.0.0): Extracting archive
- Installing brick/math (0.12.1): Extracting archive
- Installing ramsey/uuid (4.7.6): Extracting archive
- Installing psr/simple-cache (3.0.0): Extracting archive
- Installing nunomaduro/termwind (v2.1.0): Extracting archive
- Installing symfony/translation-contracts (v3.5.0): Extracting archive
- Installing symfony/translation (v7.1.3): Extracting archive
- Installing psr/clock (1.0.0): Extracting archive
- Installing symfony/clock (v7.1.1): Extracting archive
- Installing carbonphp/carbon-doctrine-types (3.2.0): Extracting archive
- Installing nesbot/carbon (3.8.0): Extracting archive
- Installing monolog/monolog (3.7.0): Extracting archive
- Installing league/mime-type-detection (1.15.0): Extracting archive
- Installing league/flysystem (3.28.0): Extracting archive
- Installing league/flysystem-local (3.28.0): Extracting archive
- Installing nette/utils (v4.0.5): Extracting archive
- Installing nette/schema (v1.3.0): Extracting archive
- Installing dflydev/dot-access-data (v3.0.3): Extracting archive
- Installing league/config (v1.2.0): Extracting archive
- Installing league/commonmark (2.5.3): Extracting archive
- Installing laravel/serializable-closure (v1.3.4): Extracting archive
- Installing laravel/prompts (v0.1.25): Extracting archive
- Installing laravel/framework (v11.23.5): Extracting archive
- Installing symfony/yaml (v7.1.4): Extracting archive
- Installing laravel/sail (v1.32.0): Extracting archive
- Installing nikic/php-parser (v5.1.0): Extracting archive
- Installing psy/psysh (v0.12.4): Extracting archive
- Installing laravel/tinker (v2.9.0): Extracting archive
- Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
- Installing mockery/mockery (1.6.12): Extracting archive
- Installing filp/whoops (2.15.4): Extracting archive
- Installing nunomaduro/collision (v8.4.0): Extracting archive
- Installing sebastian/version (5.0.1): Extracting archive
- Installing sebastian/type (5.0.1): Extracting archive
- Installing sebastian/recursion-context (6.0.2): Extracting archive
- Installing sebastian/object-reflector (4.0.1): Extracting archive
- Installing sebastian/object-enumerator (6.0.1): Extracting archive
- Installing sebastian/global-state (7.0.2): Extracting archive
- Installing sebastian/exporter (6.1.3): Extracting archive
- Installing sebastian/environment (7.2.0): Extracting archive
- Installing sebastian/diff (6.0.2): Extracting archive
- Installing sebastian/comparator (6.1.0): Extracting archive
- Installing sebastian/code-unit (3.0.1): Extracting archive
- Installing sebastian/cli-parser (3.0.2): Extracting archive
- Installing phpunit/php-timer (7.0.1): Extracting archive
- Installing phpunit/php-text-template (4.0.1): Extracting archive
- Installing phpunit/php-invoker (5.0.1): Extracting archive
- Installing phpunit/php-file-iterator (5.1.0): Extracting archive
- Installing theseer/tokenizer (1.2.3): Extracting archive
- Installing sebastian/lines-of-code (3.0.1): Extracting archive
- Installing sebastian/complexity (4.0.1): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (4.0.1): Extracting archive
- Installing phpunit/php-code-coverage (11.0.6): Extracting archive
- Installing phar-io/version (3.2.1): Extracting archive
- Installing phar-io/manifest (2.0.4): Extracting archive
- Installing myclabs/deep-copy (1.12.0): Extracting archive
- Installing phpunit/phpunit (11.3.5): Extracting archive
0/96 [>---------------------------] 0%
10/96 [==>-------------------------] 10%
20/96 [=====>----------------------] 20%
30/96 [========>-------------------] 31%
40/96 [===========>----------------] 41%
50/96 [==============>-------------] 52%
60/96 [=================>----------] 62%
70/96 [====================>-------] 72%
80/96 [=======================>----] 83%
90/96 [==========================>-] 93%
96/96 [============================] 100%
47 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
78 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
INFO Application key set successfully.
Which database will your application use? [SQLite]:
[sqlite ] SQLite
[mysql ] MySQL
[mariadb] MariaDB
[pgsql ] PostgreSQL (Missing PDO extension)
[sqlsrv ] SQL Server (Missing PDO extension)
> mysql
Default database updated. Would you like to run the default database migrations? (yes/no) [yes]:
> yes
WARN The database 'prj01' does not exist on the 'mysql' connection.
Would you like to create it? (yes/no) [yes]
❯
INFO Preparing database.
Creating migration table .............................................................................. 15.11ms DONE
INFO Running migrations.
0001_01_01_000000_create_users_table .................................................................. 13.39ms FAIL
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users` add unique `users_email_unique`(`email`))
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:825
821▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
822▕ );
823▕ }
824▕
➜ 825▕ throw new QueryException(
826▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
827▕ );
828▕ }
829▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connection.php:571
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
2 vendor\laravel\framework\src\Illuminate\Database\Connection.php:571
PDOStatement::execute()
./composer.json has been updated
Using version ^3.0 for pestphp/pest
Using version ^3.0 for pestphp/pest-plugin-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Lock file operations: 14 installs, 1 update, 0 removals
- Locking brianium/paratest (v7.5.4)
- Locking doctrine/deprecations (1.1.3)
- Locking fidry/cpu-core-counter (1.2.0)
- Locking jean85/pretty-package-versions (2.0.6)
- Locking pestphp/pest (v3.0.6)
- Locking pestphp/pest-plugin (v3.0.0)
- Locking pestphp/pest-plugin-arch (v3.0.0)
- Locking pestphp/pest-plugin-laravel (v3.0.0)
- Locking pestphp/pest-plugin-mutate (v3.0.3)
- Locking phpdocumentor/reflection-common (2.2.0)
- Locking phpdocumentor/reflection-docblock (5.4.1)
- Locking phpdocumentor/type-resolver (1.8.2)
- Locking phpstan/phpdoc-parser (1.30.1)
- Downgrading phpunit/phpunit (11.3.5 => 11.3.4)
- Locking ta-tikoma/phpunit-architecture-test (0.8.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 14 installs, 1 update, 0 removals
- Downloading pestphp/pest (v3.0.6)
0/1 [>---------------------------] 0%
1/1 [============================] 100%
- Installing pestphp/pest-plugin (v3.0.0): Extracting archive
- Downgrading phpunit/phpunit (11.3.5 => 11.3.4): Extracting archive
- Installing jean85/pretty-package-versions (2.0.6): Extracting archive
- Installing fidry/cpu-core-counter (1.2.0): Extracting archive
- Installing brianium/paratest (v7.5.4): Extracting archive
- Installing phpstan/phpdoc-parser (1.30.1): Extracting archive
- Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
- Installing doctrine/deprecations (1.1.3): Extracting archive
- Installing phpdocumentor/type-resolver (1.8.2): Extracting archive
- Installing phpdocumentor/reflection-docblock (5.4.1): Extracting archive
- Installing ta-tikoma/phpunit-architecture-test (0.8.4): Extracting archive
- Installing pestphp/pest-plugin-arch (v3.0.0): Extracting archive
- Installing pestphp/pest-plugin-mutate (v3.0.3): Extracting archive
- Installing pestphp/pest (v3.0.6): Extracting archive
- Installing pestphp/pest-plugin-laravel (v3.0.0): Extracting archive
0/5 [>---------------------------] 0%
5/5 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
laravel/sail .................................................................................................. DONE
laravel/tinker ................................................................................................ DONE
nesbot/carbon ................................................................................................. DONE
nunomaduro/collision .......................................................................................... DONE
nunomaduro/termwind ........................................................................................... DONE
pestphp/pest-plugin-laravel ................................................................................... DONE
85 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
INFO No publishable resources for tag [laravel-assets].
No security vulnerability advisories found.
INFO Preparing tests directory.
phpunit.xml ................................................................................... File already exists.
tests/Pest.php ....................................................................................... File created.
tests/TestCase.php ............................................................................ File already exists.
tests/Unit/ExampleTest.php .................................................................... File already exists.
tests/Feature/ExampleTest.php ................................................................. File already exists.
INFO Application ready in [prj01]. You can start your local development using:
➜ cd prj01
➜ php artisan serve
New to Laravel? Check out our bootcamp and documentation. Build something amazing!
========================================
C:\wamp64\www\laravel>dir
Volume in drive C is Acer
Volume Serial Number is 9CE7-F03B
Directory of C:\wamp64\www\laravel
09/15/2024 07:35 AM <DIR> .
09/12/2024 03:00 PM <DIR> ..
09/15/2024 07:36 AM <DIR> prj01
0 File(s) 0 bytes
3 Dir(s) 223,904,419,840 bytes free
========================================
C:\wamp64\www\laravel>cd prj01
C:\wamp64\www\laravel\prj01>dir
Volume in drive C is Acer
Volume Serial Number is 9CE7-F03B
Directory of C:\wamp64\www\laravel\prj01
09/15/2024 07:36 AM <DIR> .
09/15/2024 07:35 AM <DIR> ..
09/11/2024 01:12 PM 258 .editorconfig
09/15/2024 07:36 AM 1,115 .env
09/15/2024 07:36 AM 1,064 .env.example
09/11/2024 01:12 PM 186 .gitattributes
09/11/2024 01:12 PM 264 .gitignore
09/15/2024 07:35 AM <DIR> app
09/11/2024 01:12 PM 350 artisan
09/15/2024 07:35 AM <DIR> bootstrap
09/15/2024 07:36 AM 1,966 composer.json
09/15/2024 07:36 AM 319,585 composer.lock
09/15/2024 07:35 AM <DIR> config
09/15/2024 07:35 AM <DIR> database
09/11/2024 01:12 PM 244 package.json
09/11/2024 01:12 PM 1,191 phpunit.xml
09/15/2024 07:35 AM <DIR> public
09/11/2024 01:12 PM 4,109 README.md
09/15/2024 07:35 AM <DIR> resources
09/15/2024 07:35 AM <DIR> routes
09/15/2024 07:35 AM <DIR> storage
09/15/2024 07:36 AM <DIR> tests
09/15/2024 07:36 AM <DIR> vendor
09/11/2024 01:12 PM 263 vite.config.js
12 File(s) 330,595 bytes
12 Dir(s) 223,903,637,504 bytes free
========================================
MySQL:3306/ http://localhost/phpmyadmin/index.php?route=/server/sql Your SQL query has been executed successfully.
show databases;
information_schema
mysql
performance_schema
prj01
sys
prj01
migrations
users
========================================
The "laravel new prj01" command created the prj01 directory and put all the directories and files into it indicated above in the command output section. It also created the "prj01" database and the two tables indicated above.
I noticed the following error in the command output section above:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users` add unique `users_email_unique`(`email`))
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:825
* 821▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
* 822▕ );
* 823▕ }
* 824▕
* ➜ 825▕ throw new QueryException(
* 826▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
* 827▕ );
* 828▕ }
* 829▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connection.php:571
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
2 vendor\laravel\framework\src\Illuminate\Database\Connection.php:571
PDOStatement::execute()
========================================
I've searched for the solution of that error. Some of the solutions simply say to update to newer version of MySQL, I aleady am using a version newer than the version they say to upgrade to, so that is not the answer. I'll look into other supposed solutions.
========================================
What I've learned with the https://laracasts.com/series/30-days-to-learn-laravel-11 course, which I'm now at day 21 (of course I couldn't practice because I can't get a working Laravel project going), I would like to use Laravel, but I need it to install correctly for each project I will be working on, which there are currently three new projects, one will use "MariaDB" and two will use "PostgreSQL" for the databases will be huge. I do not want to have to manually correct things every time I start a new project.
It is unacceptable that I would have to correct errors every time I create a new project.
@rfm your app dont run because the migrations fails to create the tables on the database. try to add the line on the example of the laravel documentation
Schema::defaultStringLength(191);
https://laravel.com/docs/10.x/migrations#index-lengths-mysql-mariadb
then re run the migrations from scratch with this command
php artisan migrate:fresh
this command will destroy all the tables and recreated.
@acuarelasoft I did some research and what you suggest is one of the answers I've often found.
In the "your_project\app\Providers\AppServiceProvider.php" you add the following:
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
Some say that doing the above places a limit on the number of columns.
Some say that in "your_project/config/database.php" change:
"'engine' => 'null'," to "'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',"
However, doing any of the above means for every project I create I will need to make those changes and migrate again. To me, this is not a good solution, in fact it is an unacceptable solution.
I did what others suggested and it worked. This is what I did:
1) In WAMPserver (3.3.6 64bit) I hovered over MySQL and clicked "my.ini" to edit it:
; RFM 9/17/2024: commented MYISAM, uncommented InnoDB:
;default_storage_engine=MYISAM
default_storage_engine=InnoDB
[mysqld]
port=3306
; RFM 9/17/2024: Added the following 3 rows:
;innodb_file_format=Barracuda
;innodb_large_prefix=ON
;innodb_file_per_table=ON
With the three "innodb..." set, MySQL would not start, so I commented them out.
2) Then in WAMPserver (3.3.6 64bit) I hovered over MariaDB and clicked "my.ini" to edit it:
; RFM 9/17/2024: commented MYISAM, uncommented InnoDB:
;default_storage_engine=MYISAM
default_storage_engine=InnoDB
[mysqld]
port=3307
; RFM 9/17/2024: Added the following 3 rows:
innodb_file_format=Barracuda
innodb_large_prefix=ON
innodb_file_per_table=ON
Both MySQL and MariaDB started up as services.
3) I deleted the "prj01" directory and DROPped the "prj01" database from the MySQL server using phpMyAdmin (5.2.1).
4) I executed "C:\wamp64\www\laravel\laravel new prj01" and it posted no errors. Where asked I put in "mysql".
5) I clicked WAMPserver localhost and then clicked the VirtualHost "prj01" I previously created and the Laravel web page came up like it was supposed to.
6) Using phpMyAdmin (5.2.1) the "prj01" database was created and 9 tables also.
Now I can created projects without having to edit things within the project or migrate again after the edits. This is the best solution I have found and suggest that Laravel puts this solution in place of having to edit any project files.
take a moment to stop and understand the contents of the .env file. This contains default. settings for your app.
These defaukts have changed in the latest release with sqlite being used as the defaukt database driver.
Also, if you want to use mysql for database and for the sessions driver then you will need to edit your .env file to tell the framework, and run an artisan command to create the sessions table in the database. This guys video is probably out of date so you may get some discrepancies.
You can see all the artisan commands by running just php artisan
@Snapey I totally understand the .env file and nothing there solves the problem.
My reply to @acuarelasoft states what I did to solve the problem and I do not have to edit any project file. Link to my reply: https://laracasts.com/discuss/channels/laravel/problem-creating-laravel-project-laravel-installed-on-wampserver?reply=948161
Is there a way to put a clickable link in a post such as this so that clicking it brings you to the post the link is to?
why do you think you are running both mariadb and mysql? If you are, you will only be connecting to the one bound to port 3306
@Snapey So, the gist of what you are saying is that even though the time I chose "MariaDB" which runs on port 3307, it still ran the server on port 3306 which is "MySQL", that's why the project database and tables were created in "MySQL" instead of "MariaDB". The project installation procedure should not only ask for what database server to use, it should ask what port to run on and create/modify the ".env" file accordingly. Better yet, there should be a port lookup file where the project installation procedure can look up the appropriate port to use for a given database server.
@rfm works for 99% of cases. Why should the vast majority have to answer questions because a tiny minority have a non-standard setup?
https://laravel.com/docs/11.x/installation#databases-and-migrations
@Snapey You say "Why should the vast majority have to answer questions because a tiny minority have a non-standard setup?" I didn't know it was mandatory for the "vast majority" to answer. And if the "20 people have replied" is the "vast majority" there must not be very many people using Laravel.
There are a great number of people using WAMPserver, I've been using it for years, written lots PHP and JS code for the projects I set up under WAMPserver. I don't consider that a minority.
Even if I set up the project with Herd or any other set up way the "vast majority" uses, I would have encountered the same error, and many others have, see "Stack Overflow" on the matter. And most of those are using, as you say, the "vast majority" setup.
@rfm remember the install has changed, it used to default to mysql and file session. It's just a simple (a few seconds) matter to change an install to the way you choose.
I prefer composer and not the laravel installer.
@jlrdw As I stated in my first post, I'm new to Laravel, so I've seen no change, therefore, to me your statement "remember the install has changed" means nothing to me for I have nothing to compare it to.
@rfm You have the prior documentation to compare with once it was mentioned.
@jlrdw I prefer to move forward rather than learning how things were to compare that to how things are now.
I prefer to move forward rather than learning how things were to compare that to how things are now.
Using mysql is not moving backwards or using file for session is not moving backwards.
Laravel 11 just changed the default install for the "development" setup.
@jlrdw I never said "Using mysql" or "using file for session" is moving backwards. Having to read "prior documentation" is moving backwards. I'm not interested in what "prior documentation" (which I do not have) says, I'm only interested in what the current documentation says. It is rather sad that I have to explain such to you.
@rfm just FYI, documentation for all versions is via the dropdown top right of the docs. You should know about this because sometimes answers here and on google generally might link to the specific version of the docs and you might need to change from 8 to 11 for instance to know if the approach is still relevant.
Please or to participate in this conversation.