How to Setup and Run PHP Files on Server in Visual Studio Code Without XAMPP Control Panel in Browse
Jan 9, 2025
Hi Join the official discord server to resolve doubts here:
https://discord.gg/cRnjhk6nzW
Visit my Online Free Media Tool Website
https://freemediatools.com/
Buy Premium Scripts and Apps Here:
https://procodestore.com/
Show More Show Less View Video Transcript
0:00
uh hello guys welcome to this uh short
0:02
little tutorial so in this video I will
0:05
actually show you a cool little Visual
0:07
Studio code extension which allows you
0:10
to run your PHP documents without having
0:13
to install exam Apache server so if you
0:17
know in PHP if you want to run PHP
0:20
applications you need some kind of
0:21
Apache control panel this is actually
0:24
exam control panel that you install it
0:26
and it comes with the Apache mySQL
0:28
database so so you need to install this
0:30
software you need to Simply click on
0:33
start and then you need to start your
0:36
application you need to go to your uh
0:38
exam directory which is located in the C
0:40
drive and in the asht docs folder this
0:43
is basically the setup that I'm showing
0:45
you by default you do this you create a
0:48
project inside this HD dos directory so
0:51
let me just create a brand new project
0:53
here sample
0:55
project so I let me just make it
1:02
so let me just create a simple file
1:08
index.php so this is actually the
1:11
default Behavior how we actually run PHP
1:14
applications so we actually have this
1:17
PHP tag and here we write a statement
1:20
hello
1:22
world so now to run this application you
1:25
do you do need to start this ex Apache
1:28
web server and you just need to write
1:30
here simply Local Host followed by your
1:33
directory of whatever you are running so
1:36
Local Host T this is my you can see that
1:39
so now hello world is showing in the
1:41
browser so we are running this
1:43
application this is actually a default
1:45
Behavior by which you need to install
1:46
this software on your machine exam
1:48
control panel which is uh if you go to
1:51
Google it
1:53
actually exam control panel is
1:56
a uh software which is available for
2:00
Windows Mac and Linux by which you
2:02
actually run your PHP application but
2:04
now in this tutorial I would show you a
2:06
cool little extension which is available
2:08
in vs code by which you don't need to
2:12
actually start the server you don't need
2:13
to require it you can just uninstall
2:16
this if you don't need to actually need
2:18
this Apache server simply close it and
2:20
now I will show you how to run this PHP
2:22
application so this is I am here inside
2:26
my directory you will see that let me
2:28
delete everything
2:30
so let me create a file
2:33
index.php and inside this we actually
2:36
have a statement Echo hi hello
2:41
world this is PHP so I will also show
2:44
you hot reloading as you make changes
2:47
automatically your web server will
2:49
automatically reflect the changes in the
2:51
browser similar to which we have live
2:53
server for other programming languages
2:56
such as python JavaScript each and
3:00
language has a live server similarly I
3:01
will be showing you an extensions go to
3:03
the manage section right here go to
3:05
extensions and this extension you need
3:08
to Simply write PHP server just search
3:11
for this extension PHP server and there
3:14
will be a lot of extensions out there
3:16
the one that you need is actually this
3:19
one which is PHP built-in server which
3:22
is developed by David fer David Freer
3:26
this is actually the extension which
3:27
comes with hot reloading where whenever
3:30
you make any sort of changes inside your
3:31
PHP file it will automatically reload so
3:34
I already installed this extension so
3:36
let me just show you once again if I
3:38
reload this and again search for this
3:41
PHP
3:43
server and
3:46
uh so the extension will come here uh if
3:49
you drag down you will see PHP built-in
3:52
server it is developed by David FR
3:55
simply click on install and it is a
3:57
fairly new extension it is almost got
4:00
5,000 downloads so now you can see the
4:03
extension is uh uh installed globally so
4:07
it is 83 kilobyte extension and it comes
4:10
with the PHP hot reloading automatically
4:13
it reloads to your file whenever you
4:14
make any sort of changes so now you
4:17
don't need to actually have exam
4:19
installed so you can see my exam is not
4:21
running if you see my exam control panel
4:24
is not running I have just closed this
4:27
and now if you want to run this file you
4:29
need to Simply either you can right
4:32
click or the if the option is not
4:35
showing right here simply type
4:38
on uh Windows control shift p this is a
4:41
shortcut and this will open and now you
4:44
will actually have this PHP built-in
4:47
server this is actually the you can even
4:50
write as well PHP built-in server so it
4:55
will just select this option and now
4:57
your server will start and you can
5:00
basically see it is running by default
5:02
on
5:03
5,001 port number so by default exam
5:07
control panel runs your application on
5:09
at Port number Local Host 0 port number
5:11
this runs on
5:13
50001 so the nice thing about that guys
5:15
if you just put it side by side if you
5:18
make any sort of changes the hot
5:20
reloading will also be done hot
5:22
reloading is not there in examp in examp
5:25
if you basically make changes you need
5:27
to refresh the page but here if I just
5:30
show you if I make any sort of changes
5:32
if I just do this you will see
5:34
automatically it will reload I'm not
5:37
doing anything I just writing my code
5:39
and you can see on the right hand side
5:42
automatically the code will just put
5:44
your semicolon you will
5:46
see so as I'm just making the changes
5:49
automatically it is refreshing it I am
5:51
just you can see that
5:55
so hot reloading this is called as hot
5:58
reloading in PHP so whenever you write
6:00
your code you can just write HTML as
6:03
well so this is a paragraph you can also
6:06
write CSS everything you can write here
6:10
you can even write a H1
6:16
tag so you can see that so automatically
6:19
it is refreshing and you can even have
6:21
HTML document right here if you want to
6:25
just uh you can have a button right
6:28
here register
6:31
so everything is supported you will see
6:33
hot reloading is there you can even
6:35
write JavaScript as well so if you want
6:37
to have a alert statement
6:40
here you can see that it is
6:42
automatically reloading and
6:47
uh so high statement is there in the
6:50
alert statement so you can write your
6:52
PHP code side by side in the HTML code
6:55
as well CSS JavaScript everything you
6:57
can write in a one file and it will
7:00
automatically reload whenever you make
7:02
any sort of changes so in this way you
7:06
can do this so you can see that so how
7:07
easy it is guys uh this is actually the
7:10
extension that I was talking about and
7:13
uh this makes it really easy to actually
7:16
build your applications if you don't
7:17
want to install exam you can see that uh
7:21
you can have the stylesheet as well if
7:23
you want to change the background color
7:27
to red
7:30
so you can see that so in this
7:35
way you can see that so we have the PHP
7:38
code we have everything which we have so
7:43
you can just
7:50
write so you can see that guys new line
7:52
character if you want to have new line
8:01
I think we need to do write
8:05
this new line
8:08
corrector we can have a break tag right
8:12
here so it will come on the next line so
8:14
you can mix and match HTML code PHP code
8:17
uh this is the all-in-one extension guys
8:19
which comes with all these features hot
8:21
reloading everything so you don't need
8:24
exam control panel this is a best extens
8:27
best extension that I found out on vs
8:29
code that it supports uh hot reloading
8:33
you it actually supports everything you
8:36
can run your PHP so control shift p is
8:39
the shortcut and just search for PHP
8:42
built in whenever you are developing
8:44
this so you will see that so this option
8:47
will come right here PHP
8:50
built-in
8:54
server PHP
9:00
this is actually PHP buil-in server you
9:03
can see that
9:05
so this is actually the extension guys
9:08
it's very
9:11
simple so you can even directly click
9:15
this go live right here if you click
9:18
this your server will
9:22
start this is not this one this one
9:26
local hose it will run on 50001
9:44
so this is actually the extension guys
9:46
if you are interested the link is given
9:49
oh sorry you can install this
9:53
extension and this is actually the
9:57
extension PHP built-in server this is
9:59
actually the extension there are lot
10:02
more options also available if you see
10:06
now let me show you the second option uh
10:09
if you see this is a fairly new
10:10
extension if I want to uninstall this
10:14
and show you the other ones other
10:16
options as well so hot reloading is not
10:20
available with in other plugins I just
10:24
showed you if you just try out other
10:26
plugins as well uh hot reload hot
10:31
reloading is not available in this
10:32
plugin which is PHP server which is
10:34
developed by this person bra F if you
10:37
install it directly you will see it will
10:40
install it and you will get this option
10:42
right here you can serve your project
10:45
and it will again start right here if
10:47
you
10:49
see but I think in this plugin hot
10:52
reloading functionality is not there so
10:54
if I change
10:56
anything uh it will not automatically
10:59
load so you do need to refresh the page
11:01
for the changes to take place so if you
11:04
see you can remove your PHP code it will
11:07
refresh you can see that so we can add
11:10
this is also a very handy extension if
11:12
you don't want to use that one you can
11:14
use that but you need to refresh the
11:16
page for this so hot reloading is not
11:18
available for this but surely it's a
11:20
very good extension it has got 2 million
11:22
downloads and it has option directly if
11:25
you right click you will see these
11:27
options these four options which is PHP
11:30
server open file in browser reload
11:33
server Ser project so these options will
11:36
appear as you right click in the
11:38
previous plugin you do need to just say
11:40
control shift p and search for this so
11:43
it totally depends upon your preference
11:45
which plugin you want to use both these
11:48
plugins are wonderful so in both these
11:51
cases you don't need exam control panel
11:53
installed on your machine you can
11:55
directly run your PHP applications
11:56
inside your Visual Studio code so this
11:59
was a tutorial guys hopefully you like
12:02
it thank you for watching this video
12:04
please hit that like button subscribe
12:06
the channel as well and I will be seeing
12:08
you in the next video
#Development Tools
