Тёмный

How to run your HTML/PHP site on localhost with XAMPP 

Jonah Lawrence • Dev Pro Tips
Подписаться 8 тыс.
Просмотров 240 тыс.
50% 1

How to run your website locally with XAMPP. Test your site without putting it on a web server!
❤ Subscribe: bit.ly/SubscribeDPT
In this tutorial, I will show you how you can get your website running on localhost:8000 or any other port on your computer so you can run server-side code such as PHP or Node.js without uploading your files to a web server.
I will be using the Windows operating system with XAMPP and the command line.
📺 In this video I will show you:
0:19 - How to install PHP (using XAMPP)
1:48 - How to run a PHP or HTML website on a localhost port
3:08 - How to create a batch script to automatically run your site on localhost
🖥 More Web Development tutorials
▶ • Web Development
💻 More tutorials
► • Tutorials
🙋‍♂️ Find me on other channels
Discord 🗨️ bit.ly/dpt-discord
Twitter ✍ / denvercoder1
Github 👨‍💻 github.com/DenverCoder1
Sponsor 💞 github.com/sponsors/DenverCoder1
One-time donation ☕ ko-fi.com/jlawrence
💖 SPONSORS 💖
Get your username or a link to your channel here by sponsoring on Github
▶ github.com/sponsors/DenverCoder1
🎁 GET FREE STUFF WHILE SUPPORTING MY TUTORIALS
► bit.ly/jlawrencepromos

Хобби

Опубликовано:

 

25 авг 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 113   
@soldour7597
@soldour7597 2 года назад
Jonah thanks for the very easy and straight forward content it really helped
@ViktorRadioandTVDXing
@ViktorRadioandTVDXing 3 года назад
Man, it really helped me! Appriciate the good work and easy explanations! Keep up the good work! A new sub from me!
@yankeeadventurerp8082
@yankeeadventurerp8082 2 года назад
'php' is not recognized as an internal or external command, operable program or batch file. Thats what it told me
@abdelghanimoumen2524
@abdelghanimoumen2524 2 года назад
same, I panicked...
@theunitydev5418
@theunitydev5418 Год назад
did you find a solution?
@anjaliballari26
@anjaliballari26 Год назад
start xampp server when you are executing
@pertulippotato7769
@pertulippotato7769 2 года назад
only thing that worked for me, thanks bro.
@Raydamick
@Raydamick 3 года назад
hey I got a website with php and sql code from my friend to mess around with. on his pc everything works fine however when I open it on my pc the website doesn't run properly. any idea how I can fix this
@johnsubhash
@johnsubhash 2 года назад
By the way, Your voice and slang is awesome 😁
@thebuffaloman758
@thebuffaloman758 2 года назад
you saved my life!
@vijayanagaramlakshmianjali7489
Thank you so much sir .this video helps me a lot sir
@user-ws2fi3oy6h
@user-ws2fi3oy6h 2 года назад
hello. if i already download Mysql then is it okay uncheck the mysql box?
@joaoricardodearaujomoreira547
@joaoricardodearaujomoreira547 2 года назад
so nice, thx!
@amvhub5181
@amvhub5181 3 года назад
'php' is not recognized as an internal or external command, operable program or batch file.
@Luenox
@Luenox 2 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Y1niORpz5Bw.html
@eueudruadh2268
@eueudruadh2268 2 года назад
@@Luenox nice job
@rezult8484
@rezult8484 2 года назад
@@Luenox king man
@just_michael402
@just_michael402 11 месяцев назад
To fix this problem, follow these steps: 1. In the Search bar of Windows, search for “Edit the system environment variables”. 2. In the System Properties window, click on the “Environment Variables”. 3. In the Environment Variables window, under the System Variables section, double-click the “Path” variable. 4. In the Edit environment variable window, click on New and add this text: “C:\xampp\php\” This should make the 'php' command work, at least for my computer.
@JaimeBIDtravel
@JaimeBIDtravel 2 года назад
Cool tecnique! I was wondering, in the input "php -S localhost:8000" is there a way to specify a file?
@DevProTips
@DevProTips 2 года назад
For a file: php -S localhost:8000 -f filename.php For a directory: php -S localhost:8000 -t path/to/dir All options can be found using: php --help
@JaimeBIDtravel
@JaimeBIDtravel 2 года назад
@@DevProTips great!! Thanks a lot for sharing
@yararli_bilgiler8083
@yararli_bilgiler8083 10 месяцев назад
can we do it with html and css?
@augischadiegils.5109
@augischadiegils.5109 3 года назад
Thanks :)
@PrinceRaj-ns6wo
@PrinceRaj-ns6wo 2 года назад
Can you help me in fetching data from localhost or database in a html lage. I need to show the details of my data on a html page
@michall
@michall 3 года назад
ty!!
@grandmashinditales678
@grandmashinditales678 Год назад
very nice thank you ... upload some videos on cloudflare
@bahumukabharatiyam4344
@bahumukabharatiyam4344 3 года назад
tqsm
@ansarali9270
@ansarali9270 2 года назад
useful video.... but requested to perform operations slowly slowly
@MrJp1804
@MrJp1804 2 года назад
Man, when I do this I can't open the localhost and the phpmyadmin together, helpe me please!!!
@naghamtarek3610
@naghamtarek3610 2 года назад
It shows “(null)/ -no such file or directory” So how to fix it ?
@wilswils1094
@wilswils1094 26 дней назад
Merci !
@S-Lomar
@S-Lomar 8 месяцев назад
Thank you for sharing ❤️♥️❤️💗💗 ee
@jhonyaldairjuarezaparicio5441
me encanta tu video ayudame en un proyecto porfavor de localhost
@michall
@michall 3 года назад
Do you know why the .htaccess does not work on my localhost with xampp? i tryied change AllowOverride None to AllowOverride All but still doesn't work :(
@DevProTips
@DevProTips 3 года назад
Sorry, I haven't tried using a .htaccess on localhost, so I'm not sure. I'd made it sure it's in the correct directory (should be root), if that's not an issue, I'd recommend searching for solutions or possibly ask on Stack Overflow.
@collegenm
@collegenm Год назад
Hi Jonah, I know it's a relatively old video, but hopefully you see this comment. I wanted to do some PHP work and I followed your steps, but when I got to the cmd part, after I did the php-S part, although it recognized it, it still gave me this error: "Failed to listen on localhost:8080 (reason: An attempt was made to access a socket in a way forbidden by its access permissions)". Do you know what to do when this happends?
@DevProTips
@DevProTips Год назад
Likely that port is already in use. You could try a different number such as 8000, 8888, etc.
@itsmic341
@itsmic341 2 года назад
tysm! i finally found out how you can do this, great tutorial, keep it up! sub+1
@meryemchrg6138
@meryemchrg6138 2 года назад
big up !
@kvahn
@kvahn 2 года назад
I thought i was one of the only people using photopea lol
@nkosingiphilethipe726
@nkosingiphilethipe726 2 года назад
Apologies Jonah.. sincerely. Was just frustrated.. managed to open file through cmd after taking a rest. I also noticed I'm Win7 & not 10. In cmd, the php or -s alternatively say thete is no program or batch file. Otherwise my sincere apologies for the rude cold comments yesterday. Salute
@deusvultu
@deusvultu 2 года назад
Who?
@omegafala720
@omegafala720 2 года назад
You did not use Xampp in the video.
@drejaquez
@drejaquez 2 года назад
what to use?
@marius003465
@marius003465 3 года назад
Fatal error: Array and string offset access syntax with curly braces is no longer supported in C\.... what should i do?
@DevProTips
@DevProTips 3 года назад
The error is in the code. I don't know what the code looks like, but the error suggests you are trying to use { } instead of [ ] to access offsets within an array or string. Try changing it to [ ] or figure out the issue with the curly braces placement.
@marius003465
@marius003465 3 года назад
@@DevProTips Thanks for the help but after fixing previous errors y get more errors in other places.. I'm willing to pay if somebody can help me fix this crap. Thanks
@melissaammour5270
@melissaammour5270 2 года назад
Thank you very much, it's really useful !
@ajitanilbondre1
@ajitanilbondre1 2 года назад
How it's work with statick IP
@deathvaisen6381
@deathvaisen6381 9 месяцев назад
How its related with XAMPP?
@MrPillowStudios
@MrPillowStudios 2 года назад
Let it be parody: PHP, PHP, PHP, The one that helps us shine Just on the web!
@maximk7816
@maximk7816 3 года назад
what if i want more than 1 files to run locally? Do I need a specific number for local host for each of them?
@DevProTips
@DevProTips 3 года назад
Yeah, you can run multiple directories on localhost by having each with a different port number. For example, localhost:8000, localhost:8001, etc.
@maximk7816
@maximk7816 3 года назад
@@DevProTips ok thanks for the quick answer! I actually have just started with this stuff and was looking for how do I make my files (from htdocs) run. And I already found a solution, I just type in localhost:8000 (because I know this number from Xampp app) and there I see that I can actually have many folders containing entire sites.. so why would I need to have many ports for localhost? Can I just use one for all of my sites?
@maximk7816
@maximk7816 3 года назад
@@DevProTips UPDATE, I think my previous comment was stupid cs Apache works on one port, so obviously I can use it for all my sites)) Am I right?
@TimACTION
@TimACTION Год назад
i doont have the php code on my cmd?
@_n0iro.project_590
@_n0iro.project_590 2 года назад
I can only view my index.php, the other php webpages that belong to that websites don't work. If I click on them in the menu I get redirected to the XAMPP Dashboard. Any Idea what I could do? My folder has a .htaccess file too. Could that be at fault? Permalinks? RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-1 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
@abasionookon4004
@abasionookon4004 2 года назад
This is what mine shows me. 'php' is not recognized as an internal or external command, operable program or batch file. Please where did I go wrong?
@pasta_real
@pasta_real 2 месяца назад
you must have php installed
@nancyislife7750
@nancyislife7750 2 года назад
It says "the requested resource / was not found on this server." Help me sir :
@DevProTips
@DevProTips 2 года назад
Make sure to run the command in the directory containing the index.php or index.html file. Or if the file is not called index.php, make sure to add the name of the file at the end of the url
@mel3998
@mel3998 3 года назад
'php' is not recognized as an internal or external command, operable program or batch file
@DevProTips
@DevProTips 3 года назад
Assuming you have installed PHP correctly the problem is most likely that PHP did not automatically get added to the PATH environment variable. To fix that: (1) Search for "Edit the system environment variables" in the Windows search. (2) Click the "Environment Variables..." button. (3) Double click on the "Path" variable (either top or bottom). (4) Click "New" and enter the path to the folder containing "php.exe" (by default, using XAMPP, it is "C:\xampp\php\". Let me know if that helps.
@koen750
@koen750 3 года назад
@@DevProTips Hey, i did that but i still have the same problem.
@BabyInBattle
@BabyInBattle 3 года назад
@@koen750 Restart Apache and it should work.
@nellyponegelo
@nellyponegelo 3 года назад
@@BabyInBattle i restarted Apache but it didn't work
@drejaquez
@drejaquez 2 года назад
@@nellyponegelo same here
@angelsly9595
@angelsly9595 2 года назад
myhadoop localhost 8088 is not showing
@badmashito4059
@badmashito4059 2 года назад
Bro I have mysql installed on my laptop . if I install xampp will it create problem ? Please reply as soon as possible ..
@DevProTips
@DevProTips 2 года назад
It should be fine especially if you aren't installing it fit the mysql. If you want to have two mysql servers running at the same time, you'd probably have to change the port number of one of them.
@badmashito4059
@badmashito4059 2 года назад
@@DevProTips yes..Now I understand . Means if I want to run both of them simultaneously I have to change my port number of one of them . And if I want to run only one either xampp or mysql then its fine. Anyways thanks a lot buddy.. And thanks a lot for the fast reply 🙇‍♂️🙇‍♂️
@marcousmalicdem5669
@marcousmalicdem5669 3 года назад
i already have my php file. but my localhost cant read. can you help me
@DevProTips
@DevProTips 3 года назад
Do you get any particular errors?
@Rapchik-Studio
@Rapchik-Studio 2 года назад
@@DevProTips issue in port number
@sheldoncooper7385
@sheldoncooper7385 2 года назад
Wanna ask, how do we collaborate with other team members on the same database?
@DevProTips
@DevProTips 2 года назад
Most databases can be hosted on a remote server where anyone can log in given the host name, username, and password. Many VPS set ups may include it, with Heroku, you can get a free postgres database by adding it as an add-on to a project. To collaborate on the codebase, GitHub is very useful and integrates well with many hosting platforms.
@SavagexWolfZ
@SavagexWolfZ 3 года назад
In my command prompt it says ‘php’ is not recognized as an internet or external command
@DevProTips
@DevProTips 3 года назад
Assuming you have installed PHP correctly the problem is most likely that PHP did not automatically get added to the PATH environment variable. To fix that: (1) Search for "Edit the system environment variables" in the Windows search. (2) Click the "Environment Variables..." button. (3) Double click on the "Path" variable (either top or bottom). (4) Click "New" and enter the path to the folder that contains "php.exe" (If you set up XAMPP with the default settings it will probably be "C:\xampp\php\" but you should check that it actually is there). Let me know if that helps.
@SavagexWolfZ
@SavagexWolfZ 3 года назад
@@DevProTips thank u!!
@SavagexWolfZ
@SavagexWolfZ 3 года назад
@@DevProTips it still said the same thing
@SavagexWolfZ
@SavagexWolfZ 3 года назад
Do u have discord?
@DevProTips
@DevProTips 3 года назад
@@SavagexWolfZ I have a Discord server if you want to ask there discord.gg/fPrdqh3Zfu
@miraslanliyev2184
@miraslanliyev2184 2 года назад
*PHP is not recognized as an internal or external command in command prompt* If you have this problem,you need edit system variables *How edit system enviroment variables?* watch this video:ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Y1niORpz5Bw.html
@ZoomGadget
@ZoomGadget 2 года назад
When I type "php -s localhost:8000" I get "Could not open input file: localhost:8000"
@DevProTips
@DevProTips 2 года назад
You need to use an uppercase -S
@zlanzuodaynuahjr.5260
@zlanzuodaynuahjr.5260 Год назад
It didn't work with my computer
@YuriGen2423
@YuriGen2423 2 года назад
how i host the html? is the same command?
@DevProTips
@DevProTips 2 года назад
To self-host the website, you could use something like ngrok. Some simple hosting options include: GitHub Pages, netlify, Heroku, awardspace, 000webhost. You can host html online with any of those. Many hosting platforms allow uploading html with FTP, others can deploy automatically from GitHub.
@ryujin2810
@ryujin2810 2 года назад
It says no such file or directory please help me
@DevProTips
@DevProTips 2 года назад
Make sure the S is uppercase
@challacnr8494
@challacnr8494 2 года назад
Without net connect it is running
@hogware326
@hogware326 3 года назад
Could not open input file localhost
@DevProTips
@DevProTips 3 года назад
Make sure the S is uppercase. The command is: php -S localhost:8000
@hogware326
@hogware326 3 года назад
@@DevProTips when i type that it didn't work hhhhh i realized that i have typed s not S
@hogware326
@hogware326 3 года назад
@@DevProTips thx for replying
@fichtltuning
@fichtltuning 3 года назад
@@DevProTips what if i use html5
@drezz8783
@drezz8783 3 года назад
does this work on sublime?
@DevProTips
@DevProTips 3 года назад
Yeah, you can edit the files with any text editor
@drezz8783
@drezz8783 3 года назад
@@DevProTips Thanks!
@drezz8783
@drezz8783 3 года назад
@@DevProTips btw, does it run on html?
@johndemesa5196
@johndemesa5196 2 года назад
it doesn't work
@michaelcombrink8165
@michaelcombrink8165 Год назад
help me obiwan kenobi you're my only hope way to come in clutch
@abdou2617
@abdou2617 3 года назад
plus de détaille svp
@eueudruadh2268
@eueudruadh2268 2 года назад
Unsupported SSL request
@nkosingiphilethipe726
@nkosingiphilethipe726 2 года назад
Thumbs Down cause I'm immediately lost at LOCAL HOST (and that is the ACTUAL whole point). How all of a sudden Cmd is opened & the test project is connected. I hate it when these free short RU-vid tutorials change from clean step by step to some quick magical NOW WE ARE ON THIS WINDOW... It's like you selling Titles for Clicks
@nkosingiphilethipe726
@nkosingiphilethipe726 2 года назад
from other comments, sounds like pros understand you. Definitely not for beginners as myself
@slowyourroll1146
@slowyourroll1146 4 месяца назад
everything is done onscreen though? if you want to open the cmd prompt all you need to do is navigate to your project folder and type 'cmd' in the file explorer address bar.
@Code7s
@Code7s 2 года назад
may force be with you
@belkYT
@belkYT 2 года назад
Send the damn link smh
@Rapchik-Studio
@Rapchik-Studio 2 года назад
Need help
@DevProTips
@DevProTips 2 года назад
I'm happy to help on Discord discord.gg/fPrdqh3Zfu
Далее
How To Run PHP Projects in XAMPP Server
23:05
Просмотров 62 тыс.
У каждого есть такой друг😂
00:31
Backstage or result?😈🔥 @milanaroller
00:12
Просмотров 7 млн
Мама ударила дочь #shorts #iribaby
00:17
How to Create Website using Xampp
19:15
Просмотров 285 тыс.
How to test a local website on your phone
7:48
Просмотров 380 тыс.
Signup and Login with PHP and MySQL
43:16
Просмотров 265 тыс.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
Просмотров 891 тыс.
How to put an HTML website online (on the Internet)
29:37
10 CSS Pro Tips - Code this, NOT that!
9:39
Просмотров 2,1 млн
XAMPP SERVER ONLINE WITHOUT BUYING A HOSTING PLAN
7:10
28 мая 2024 г.
1:00
Просмотров 5 млн
How to sign the letter J?❤️
0:47
Просмотров 42 млн
28 мая 2024 г.
1:00
Просмотров 5 млн