PHP Sessions & Cookies - Output Buffering - Headers Already Sent Warning - Full PHP 8 Tutorial

  Рет қаралды 30,846

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 99
@yinonelbaz5309
@yinonelbaz5309 Жыл бұрын
You taught me a lot of brand new things in this video! This whole issue of Sessions and cookies was a lot in the dark for me, now you've put the sun on it, I love you Gio!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Super happy to hear that, glad it was helpful, thank you 💙💙💙
@lairotuT-Tutorial
@lairotuT-Tutorial 3 ай бұрын
Never have seen this example of the php close tag problem. Great work Gio!
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
Thank you 💙
@mwaas
@mwaas Жыл бұрын
all things is quite perfect from the clear voice and accent to the amazing content , clear explanation , explanation of all deep topics .. and the best things is explain all things not just basic stuff
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙌. Glad to hear you like the videos 💙
@aleksandrkanygin2672
@aleksandrkanygin2672 3 жыл бұрын
Very informative as always. Merry Christmas, hope your channel grows next year!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 💙. Merry Christmas & happy holidays 🎄⛄
@QorashyTech
@QorashyTech Жыл бұрын
Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you for your support 🙏
@truthteachers
@truthteachers Жыл бұрын
Thanks
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks for support 💙
@АйбекУшыншыканал
@АйбекУшыншыканал 2 ай бұрын
A good course, I am waiting for a video on microservice architecture )
@ProgramWithGio
@ProgramWithGio 2 ай бұрын
Thank you
@Zubbee
@Zubbee 2 жыл бұрын
Ok so, I've used session start before. It was more like I copied it. It wasn't explained in the video I watched. I just knew the guy wrote it at the top of the script. No understanding at all. So I'm very grateful for this video and also grateful to know that you talk about it more in the 3rd section. Thanks Gio.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad to hear it was helpful, thank you
@Abdulrahman-Mohamed
@Abdulrahman-Mohamed 2 жыл бұрын
Perfect Perfect Perfect .. Nobody says these details, thank you really alot. #Respect
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome & thank you 🙌
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
I enjoy learning PHP on this channel. Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear that, thank you
@skundu9009
@skundu9009 2 жыл бұрын
Excellent work Sir... you pointed out each n every small small things, that no one talk about it...
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it, thank you
@Armando-px8hi
@Armando-px8hi Жыл бұрын
Understood by watching it just one time as always😅Thanks GIO for helping us to go and get our dream job.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You got this 🤞👏
@karolzamojcin1886
@karolzamojcin1886 Жыл бұрын
Astounding as always 🏆
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you
@jrd1sso
@jrd1sso Жыл бұрын
I really learned a lot of things, THANK YOU!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear 🙌
@KochADV
@KochADV 26 күн бұрын
very good. thanks
@ProgramWithGio
@ProgramWithGio 26 күн бұрын
Thank you
@mimoh2000
@mimoh2000 2 жыл бұрын
Hi Gio, Some how, am not getting the increatment from $_Session['count']. Here are the codes: Home Class inside the index(), i added $_SESSION['count'] = ($_SERVER['count'] ?? 0 )+ 1 ; and on the index page var_dump($_SESSION); I am getting only one on the browser, Using Nginx with PHP 8.1.9. Thanks for your anticipated response. Also, the buffering has been set to 0 from my php.ini file.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello. You are using SERVER super global instead of SESSION in assignment. Change it to session and then it should work
@mimoh2000
@mimoh2000 2 жыл бұрын
@@ProgramWithGio Thanks. I just wasn't paying close attention. Thanks. Continuing.
@ekramulhasanshawon5655
@ekramulhasanshawon5655 10 ай бұрын
awesome dear
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Thank you
@issaissifou3579
@issaissifou3579 2 жыл бұрын
Thank you so much!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome 👍
@GillesBeaulacJoe
@GillesBeaulacJoe 2 жыл бұрын
Hi Gio - Love your course, I'm following every lesson. Thank you. My question: How would you manage that users session would stay active the whole day? Currently, the browser ends session after about 30 minutes or so of inactivity. My users log in and once logged in they refer to the app in different ways, but they don't sit there and look at the app, they multi-task and sometimes they are on a phone call - whatever it is, I must prevent the session from ending after non-activity - I only want the session to end at the end of the day.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello. Thank you for your support 💙. This mainly depends on how your code is set up, sessions configured, how it's persisted, etc. There are different ways you can implement this. You can have ajax call every few minutes or so to kind of ping activity & extend the session, you can play with session timeouts, can use cookies, etc.
@vkdgames
@vkdgames 2 жыл бұрын
Good stuff, thank you !
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you liked it. Thank you
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
💙
@mimlog6593
@mimlog6593 Жыл бұрын
Thanks for everything you do Gio, but please I would like to know how you are able to edit your php.ini file
@ProgramWithGio
@ProgramWithGio Жыл бұрын
I apologize, I should've mentioned this in the video & seems like I left it out by accident. Create a local.ini file in your docker directory if you are on docker, add whatever configs you want to change in that file, then in your docker-compose add this line within the app container section in volumes: - ./local.ini:/usr/local/etc/php/conf.d/local.ini rebuild the containers & you should be good. You can see example here: github.com/ggelashvili/expennies/tree/P2_Start/docker
@mimlog6593
@mimlog6593 Жыл бұрын
@@ProgramWithGio thanks, you are doing a great job😀
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@mimlog6593 no problem 👍
@sadegha7724
@sadegha7724 2 жыл бұрын
Handy, thanks
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
👍👍
@federicobau8651
@federicobau8651 3 жыл бұрын
great video
@momahdy
@momahdy Жыл бұрын
Please tell me how does your app auto reflects code changes without the need to do a docker build
@ProgramWithGio
@ProgramWithGio Жыл бұрын
When I change something in Dockerfile I run docker build behind the scenes and I mention in video that you should run it too. Otherwise if nothing has changed in Dockerfile or docker-compose then there is no need to rebuild
@momahdy
@momahdy Жыл бұрын
@@ProgramWithGio thanks, at my project I change the php code but it's not reflected inside container
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@momahdy put your project in GitHub and DM me on Twitter and I can help troubleshoot it. Most likely some misconfiguration
@mibrahim4245
@mibrahim4245 2 жыл бұрын
Awesome video !! .. but I have a question, I set the PHP session cookie to httponly (in server settings) and indeed the httponly mark showed up.. but why when I type document.cookie in the console I can still see the cookie value ? Thanks
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Sorry, just saw this comment, I was not notified for some reason. Are you sure the cookie is httponly? If you can send me the screenshots of the way you set the cookie & the console.log of the document.cookie that would be helpful, you can send it to me on Twitter
@mibrahim4245
@mibrahim4245 2 жыл бұрын
@@ProgramWithGio thanks for the reply 🌹 .. Yes plz I'd be grateful if you share your Twitter ID here 🙏
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@mibrahim4245 its on my KZbin channel about page. @Giodev8
@mdsirazul9231
@mdsirazul9231 Жыл бұрын
Hi Sir How are you, I need some help.I make a copy of the container php.ini on my host computer. If I change something in my host php.ini it doesn't change in container php.ini, how can I do that?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You need to add it to your docker-compose file under volumes
@AlexFloppy
@AlexFloppy Жыл бұрын
Do we have these code shared some where on github?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
When we get to parts where there is something to share yes it's on GitHub & link in description. For some videos there isn't much to share since it's mostly theory & a scratchpad basically
@comounburro
@comounburro 3 жыл бұрын
When is the third sections going to be released?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
There is one more video for section 2 scheduled to be released next week, then there will be a summary of what we did in the 2nd section (and a small exercise). After that, we'll begin 3rd section. Probably we'll start in a couple of weeks.
@truthteachers
@truthteachers Жыл бұрын
Bro, in this video i see in the Home class it uses the view class. I have been following the course from the start and none of the previous videos talked about views. Please advise in which video was view covered before this one. Thank you.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That one slipped into this video, you dont need to worry about it, we cover it within the MVC video which is 2.27, so you will get to it in 2 videos
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio Great thank you. Appreciated.
@dameeldiop341
@dameeldiop341 2 жыл бұрын
Excellent as usual, just want to know how to copy the php.ini from wherever its source to the docker folder so I can edit things easily.. Google failed me on that so far Thanks again.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. I might make a separate video on that since a few others have asked the same. Basically, you can either copy your custom php.ini from Dockerfile or from docker-compose. Within your docker-compose, under volumes, you can create a section to copy your local php.ini to the proper location, something like: volumes: - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
@aerohcss
@aerohcss 3 ай бұрын
Gio, I've noticed that you run scripts in browser or via CLI and never directly via PHP Storm (Shift + F10). Is it just personal preferences or run scripts this way really worse than CLI? Thank you.
@ProgramWithGio
@ProgramWithGio 2 ай бұрын
Not everyone has IDE and may not understand what's happening. Showing results in browser or running it in CLI makes following along a bit easier.
@bakosyy
@bakosyy Жыл бұрын
Hello Gio. Is it ok to also say that "Once RESPONSE is sent to a page, you can no longer send any further headers" instead of "Once HEADERS are sent to a page, you can no longer send any further headers"?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
yea cause response would also be sending headers
@michaelwest842
@michaelwest842 2 жыл бұрын
Howdy Gio, I cannot do this lesson because of a fatal error. You say go to Home.php and have use App\View as well as $_SESSION['count'] = ($_SESSION['count'] ?? 0) +1; return View::make('index', $_GET)->render(); However, we do not yet view yet, what do we need to include in it.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello, you can comment that out, views are covered later and we implement that part. I had to re-record a small part of this video and recorded it with the code from a future lesson. You don't need views in this lesson so you can comment it out and just return string like in other methods.
@1Kicaj
@1Kicaj 2 жыл бұрын
Hi Gio, i dont get the fact we can't see the warning which is caused by having output_buffering > 0, start_session triggers E_WARNING, but if we do something like include('file_not_exists.php') it also trigger E_WARNING but this time we will see in a browser Warning: include(file_not_exists.php)...... So what's the difference between E_WARNING caused by start_session and include ?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
start session doesn't always trigger warning when output buffering is > 0 because content isn't echoed on the screen until the end of the script or until it has buffered 4KB or whatever the output buffering is set to. Watch the part from 1:18 - 2:05 where I explain it.
@1Kicaj
@1Kicaj 2 жыл бұрын
@@ProgramWithGio yeaa, after some experiments with headers_sent() and curl -v to see fully response i finally understand that. thank you for your answer, and the whole course :)
@stephen.cabreros
@stephen.cabreros Жыл бұрын
did I miss a video where you setup the php ini?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
No don't think you did. Check my reply to Mim Log's comment here
@stephen.cabreros
@stephen.cabreros Жыл бұрын
@@ProgramWithGio thanks so much Gio
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@stephen.cabreros no problem 🙌
@idemous
@idemous 2 жыл бұрын
Can you create a video about JWT?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Maybe in future, I'll add it to the list. Thank you for the suggestion.
@CodeWithAbirOfficial
@CodeWithAbirOfficial 11 ай бұрын
🎉
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
💙
@sergeisurin2963
@sergeisurin2963 Жыл бұрын
👍🙏
@ProgramWithGio
@ProgramWithGio Жыл бұрын
🙏
@truthteachers
@truthteachers Жыл бұрын
Bro I asked this question 2 videos ago but did not get help. The question is this. I find that the info produced by $_SERVER differs terribly when I use xampp to run the script and when i use the PHP inbuilt server "php -S localhost:3000". I am using Windows 10 and PHP 8.1.12. This conflict becomes critical when i try to get REQUEST_URI parameter. When i use Xampp i get "/MyCoursesLG/php/courses/piocourse/src/public/" but when i use inbuilt server i get "/". This creates unnecessary coding variations especially when i tried to create basic routing. Why does this happen and how to resolve this?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
I don't always get notified of all comments from KZbin. When using something like XAMPP it runs using apache & apache has its own config which sets some of the options. php server may not set all of those things or may set them differently so there might be difference in what is available within $_SERVER variable. DM me on Twitter & send me your XAMPP apache vhost configuration to see if there is a misconfiguration.
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio Its ok. I realize that this is something that PHP developers need to fix immediately. I think it is important that they need to keep results consistent otherwise the value of the language will be lost. I am getting a similar problem with the time() function. The cookie is set using the UTC time although i have already specified the TimeZone as my local time in the ini file. The stupidity in this is that the expiry is checked against my local time but the cookie is created using UTC. Sigh!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@truthteachers I don't think there is an issue with it though, you should be able to configure most of the things including the timezones. For cookie you set expiration in unix timestamp essentially which is UTC. It shouldn't matter what time zone is on client.
@ilya_123__
@ilya_123__ 11 ай бұрын
thank you!
@ProgramWithGio
@ProgramWithGio 11 ай бұрын
You're welcome!
PHP File Uploads - Full PHP 8 Tutorial
8:32
Program With Gio
Рет қаралды 23 М.
PHP Generators Explained - Full PHP 8 Tutorial
25:47
Program With Gio
Рет қаралды 32 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
PHP MVC Pattern - View Parameters Exploit - Full PHP 8 Tutorial
22:17
Program With Gio
Рет қаралды 41 М.
PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial
31:41
Program With Gio
Рет қаралды 34 М.
PHP Docker Tutorial - Nginx - PHPFPM VS Apache - Full PHP 8 Tutorial
14:39
PHP - Encapsulation & Abstraction -  Full PHP 8 Tutorial
15:23
Program With Gio
Рет қаралды 33 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН