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

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • How to run your website locally with XAMPP. Test your site without putting it on a web server!
    ❤ Subscribe: bit.ly/Subscrib...
    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-dis...
    Twitter ✍ / denvercoder1
    Github 👨‍💻 github.com/Den...
    Sponsor 💞 github.com/spo...
    One-time donation ☕ ko-fi.com/jlaw...
    💖 SPONSORS 💖
    Get your username or a link to your channel here by sponsoring on Github
    ▶ github.com/spo...
    🎁 GET FREE STUFF WHILE SUPPORTING MY TUTORIALS
    ► bit.ly/jlawren...

Комментарии • 117

  • @yankeeadventurerp8082
    @yankeeadventurerp8082 2 года назад +16

    'php' is not recognized as an internal or external command,
    operable program or batch file. Thats what it told me

  • @amvhub5181
    @amvhub5181 3 года назад +24

    'php' is not recognized as an internal or external command,
    operable program or batch file.

    • @Luenox
      @Luenox 3 года назад +8

      ruclips.net/video/Y1niORpz5Bw/видео.html

    • @eueudruadh2268
      @eueudruadh2268 3 года назад +2

      @@Luenox nice job

    • @rezult8484
      @rezult8484 2 года назад +1

      @@Luenox king man

    • @just_michael402
      @just_michael402 Год назад +3

      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.

    • @Santi_HelpersWindows10Arrasio
      @Santi_HelpersWindows10Arrasio 16 часов назад

      No. He's Is Download Setup But XAMPP does createds.

  • @soldour7597
    @soldour7597 2 года назад +4

    Jonah thanks for the very easy and straight forward content it really helped

  • @pertulippotato7769
    @pertulippotato7769 2 года назад +1

    only thing that worked for me, thanks bro.

  • @ViktorRadioandTVDXing
    @ViktorRadioandTVDXing 3 года назад +13

    Man, it really helped me! Appriciate the good work and easy explanations! Keep up the good work!
    A new sub from me!

  • @Raydamick
    @Raydamick 3 года назад +1

    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

  • @yararli_bilgiler8083
    @yararli_bilgiler8083 Год назад +2

    can we do it with html and css?

  • @JaimeBIDtravel
    @JaimeBIDtravel 2 года назад +7

    Cool tecnique! I was wondering, in the input "php -S localhost:8000" is there a way to specify a file?

    • @DevProTips
      @DevProTips  2 года назад +5

      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 года назад +1

      @@DevProTips great!! Thanks a lot for sharing

    • @Santi_HelpersWindows10Arrasio
      @Santi_HelpersWindows10Arrasio 16 часов назад

      @@DevProTips Wait, This is You are Smart And On Your Computer?

  • @michall
    @michall 3 года назад +1

    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 года назад +1

      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.

  • @johnsubhash
    @johnsubhash 2 года назад

    By the way, Your voice and slang is awesome 😁

  • @vijayanagaramlakshmianjali7489
    @vijayanagaramlakshmianjali7489 2 года назад

    Thank you so much sir .this video helps me a lot sir

  • @naghamtarek3610
    @naghamtarek3610 2 года назад

    It shows “(null)/ -no such file or directory”
    So how to fix it ?

  • @user-ws2fi3oy6h
    @user-ws2fi3oy6h 2 года назад

    hello. if i already download Mysql then is it okay uncheck the mysql box?

  • @nancyislife7750
    @nancyislife7750 2 года назад +1

    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

  • @nkosingiphilethipe726
    @nkosingiphilethipe726 2 года назад +1

    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

  • @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 6 месяцев назад

      you must have php installed

  • @thebuffaloman758
    @thebuffaloman758 2 года назад

    you saved my life!

  • @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 года назад +1

      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

  • @MrJp1804
    @MrJp1804 2 года назад

    Man, when I do this I can't open the localhost and the phpmyadmin together, helpe me please!!!

  • @Santi_HelpersWindows10Arrasio
    @Santi_HelpersWindows10Arrasio 16 часов назад

    This as At WebPage is HTML On My LocalHost:Number is The Code To This By, System32 On Cmd Flie? -_- What Happen You Just Downloaded Lol. [You Can Need i ReStart Your WebPage Computers]

  • @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

  • @grandmashinditales678
    @grandmashinditales678 Год назад

    very nice thank you ... upload some videos on cloudflare

  • @joaoricardodearaujomoreira547
    @joaoricardodearaujomoreira547 2 года назад

    so nice, thx!

  • @maximk7816
    @maximk7816 3 года назад +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 года назад +1

      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?

  • @ryujin2810
    @ryujin2810 3 года назад

    It says no such file or directory please help me

    • @DevProTips
      @DevProTips  3 года назад

      Make sure the S is uppercase

  • @omegafala720
    @omegafala720 2 года назад +3

    You did not use Xampp in the video.

  • @angelsly9595
    @angelsly9595 2 года назад

    myhadoop localhost 8088 is not showing

  • @ansarali9270
    @ansarali9270 2 года назад

    useful video.... but requested to perform operations slowly slowly

  • @wilswils1094
    @wilswils1094 4 месяца назад

    Merci !

  • @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

  • @collegenm
    @collegenm 2 года назад +1

    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  2 года назад +3

      Likely that port is already in use. You could try a different number such as 8000, 8888, etc.

  • @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 года назад +1

      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 🙇‍♂️🙇‍♂️

  • @deathvaisen6381
    @deathvaisen6381 Год назад

    How its related with XAMPP?

  • @hogware326
    @hogware326 3 года назад +2

    Could not open input file localhost

    • @DevProTips
      @DevProTips  3 года назад +4

      Make sure the S is uppercase. The command is: php -S localhost:8000

    • @hogware326
      @hogware326 3 года назад +3

      @@DevProTips when i type that it didn't work hhhhh i realized that i have typed s not S

    • @hogware326
      @hogware326 3 года назад +2

      @@DevProTips thx for replying

    • @fichtltuning
      @fichtltuning 3 года назад

      @@DevProTips what if i use html5

  • @michall
    @michall 3 года назад

    ty!!

  • @zlanzuodaynuahjr.5260
    @zlanzuodaynuahjr.5260 Год назад

    It didn't work with my computer

  • @augischadiegils.5109
    @augischadiegils.5109 3 года назад

    Thanks :)

  • @MrPillowStudios
    @MrPillowStudios 2 года назад

    Let it be parody:
    PHP,
    PHP,
    PHP,
    The one that helps us shine
    Just on the web!

  • @bahumukabharatiyam4344
    @bahumukabharatiyam4344 3 года назад

    tqsm

  • @_n0iro.project_590
    @_n0iro.project_590 3 года назад

    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]

  • @meryemchrg6138
    @meryemchrg6138 2 года назад

    big up !

  • @ajitanilbondre1
    @ajitanilbondre1 3 года назад

    How it's work with statick IP

  • @S-Lomar
    @S-Lomar 11 месяцев назад

    Thank you for sharing ❤️♥️❤️💗💗 ee

  • @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 3 года назад

      @@DevProTips issue in port number

  • @kvahn
    @kvahn 2 года назад

    I thought i was one of the only people using photopea lol

  • @melissaammour5270
    @melissaammour5270 2 года назад +1

    Thank you very much, it's really useful !

  • @challacnr8494
    @challacnr8494 2 года назад

    Without net connect it is running

  • @jhonyaldairjuarezaparicio5441
    @jhonyaldairjuarezaparicio5441 Год назад

    me encanta tu video ayudame en un proyecto porfavor de localhost

  • @SavagexWolfZ
    @SavagexWolfZ 3 года назад

    In my command prompt it says ‘php’ is not recognized as an internet or external command

    • @DevProTips
      @DevProTips  3 года назад +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:ruclips.net/video/Y1niORpz5Bw/видео.html

  • @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.

  • @sheldoncooper7385
    @sheldoncooper7385 2 года назад +1

    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.

  • @itsmic341
    @itsmic341 2 года назад

    tysm! i finally found out how you can do this, great tutorial, keep it up! sub+1

  • @johndemesa5196
    @johndemesa5196 2 года назад

    it doesn't work

  • @eueudruadh2268
    @eueudruadh2268 3 года назад

    Unsupported SSL request

  • @michaelcombrink8165
    @michaelcombrink8165 Год назад

    help me obiwan kenobi you're my only hope
    way to come in clutch

  • @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?

  • @belkYT
    @belkYT 2 года назад

    Send the damn link smh

  • @Rapchik-Studio
    @Rapchik-Studio 3 года назад

    Need help

    • @DevProTips
      @DevProTips  3 года назад

      I'm happy to help on Discord discord.gg/fPrdqh3Zfu

  • @abdou2617
    @abdou2617 3 года назад

    plus de détaille svp

  • @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 RUclips 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 7 месяцев назад

      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

  • @mel3998
    @mel3998 3 года назад +2

    'php' is not recognized as an internal or external command, operable program or batch file

    • @DevProTips
      @DevProTips  3 года назад +6

      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 года назад +3

      @@DevProTips Hey, i did that but i still have the same problem.

    • @BabyInBattle
      @BabyInBattle 3 года назад +1

      @@koen750 Restart Apache and it should work.

    • @nellyponegelo
      @nellyponegelo 3 года назад +1

      @@BabyInBattle i restarted Apache but it didn't work

    • @drejaquez
      @drejaquez 2 года назад

      @@nellyponegelo same here