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...
'php' is not recognized as an internal or external command,
operable program or batch file. Thats what it told me
same, I panicked...
did you find a solution?
start xampp server when you are executing
Does you Copieds The Comments!
'php' is not recognized as an internal or external command,
operable program or batch file.
ruclips.net/video/Y1niORpz5Bw/видео.html
@@Luenox nice job
@@Luenox king man
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.
No. He's Is Download Setup But XAMPP does createds.
Jonah thanks for the very easy and straight forward content it really helped
only thing that worked for me, thanks bro.
Man, it really helped me! Appriciate the good work and easy explanations! Keep up the good work!
A new sub from me!
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
can we do it with html and css?
Cool tecnique! I was wondering, in the input "php -S localhost:8000" is there a way to specify a file?
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
@@DevProTips great!! Thanks a lot for sharing
@@DevProTips Wait, This is You are Smart And On Your Computer?
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 :(
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.
By the way, Your voice and slang is awesome 😁
Thank you so much sir .this video helps me a lot sir
It shows “(null)/ -no such file or directory”
So how to fix it ?
hello. if i already download Mysql then is it okay uncheck the mysql box?
It says "the requested resource / was not found on this server."
Help me sir :
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
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
Who?
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?
you must have php installed
you saved my life!
Fatal error: Array and string offset access syntax with curly braces is no longer supported in C\.... what should i do?
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.
@@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
Man, when I do this I can't open the localhost and the phpmyadmin together, helpe me please!!!
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]
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
very nice thank you ... upload some videos on cloudflare
so nice, thx!
what if i want more than 1 files to run locally? Do I need a specific number for local host for each of them?
Yeah, you can run multiple directories on localhost by having each with a different port number. For example, localhost:8000, localhost:8001, etc.
@@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?
@@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?
i doont have the php code on my cmd?
It says no such file or directory please help me
Make sure the S is uppercase
You did not use Xampp in the video.
what to use?
myhadoop localhost 8088 is not showing
useful video.... but requested to perform operations slowly slowly
Merci !
When I type "php -s localhost:8000" I get "Could not open input file: localhost:8000"
You need to use an uppercase -S
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?
Likely that port is already in use. You could try a different number such as 8000, 8888, etc.
Bro I have mysql installed on my laptop . if I install xampp will it create problem ? Please reply as soon as possible ..
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.
@@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 🙇♂️🙇♂️
How its related with XAMPP?
Could not open input file localhost
Make sure the S is uppercase. The command is: php -S localhost:8000
@@DevProTips when i type that it didn't work hhhhh i realized that i have typed s not S
@@DevProTips thx for replying
@@DevProTips what if i use html5
ty!!
It didn't work with my computer
Thanks :)
Let it be parody:
PHP,
PHP,
PHP,
The one that helps us shine
Just on the web!
tqsm
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]
big up !
How it's work with statick IP
Thank you for sharing ❤️♥️❤️💗💗 ee
i already have my php file. but my localhost cant read. can you help me
Do you get any particular errors?
@@DevProTips issue in port number
I thought i was one of the only people using photopea lol
Thank you very much, it's really useful !
Without net connect it is running
me encanta tu video ayudame en un proyecto porfavor de localhost
In my command prompt it says ‘php’ is not recognized as an internet or external command
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.
@@DevProTips thank u!!
@@DevProTips it still said the same thing
Do u have discord?
@@SavagexWolfZ I have a Discord server if you want to ask there discord.gg/fPrdqh3Zfu
*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
how i host the html? is the same command?
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.
Wanna ask, how do we collaborate with other team members on the same database?
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.
tysm! i finally found out how you can do this, great tutorial, keep it up! sub+1
it doesn't work
Unsupported SSL request
help me obiwan kenobi you're my only hope
way to come in clutch
does this work on sublime?
Yeah, you can edit the files with any text editor
@@DevProTips Thanks!
@@DevProTips btw, does it run on html?
Send the damn link smh
Need help
I'm happy to help on Discord discord.gg/fPrdqh3Zfu
plus de détaille svp
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
from other comments, sounds like pros understand you. Definitely not for beginners as myself
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.
may force be with you
'php' is not recognized as an internal or external command, operable program or batch file
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.
@@DevProTips Hey, i did that but i still have the same problem.
@@koen750 Restart Apache and it should work.
@@BabyInBattle i restarted Apache but it didn't work
@@nellyponegelo same here