Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här skapar du en lokal site i WordPress med XAMPP

WPBeginner-teamet skapar regelbundet lokala WordPress-webbplatser på sina datorer för att testa teman, tillägg och webbplatsfunktioner utan att påverka en live site.

XAMPP är en gratis programvara med open source som erbjuder en användarvänlig plattform för att skapa en lokal WordPress instance.

I den här artikeln visar vi dig hur du enkelt skapar en lokal WordPress site med XAMPP så att du kan experimentera med WordPress och förfina dina färdigheter som utvecklare i en säker miljö.

Creating local WordPress install using XAMPP

Varför skapa en lokal site i WordPress?

Att skapa lokala WordPress webbplatser är en vanlig metod bland utvecklare och ägare av sites. Det allow you att testa WordPress utan att skapa en faktisk website på internet.

Språkversioner av websites är bara synliga för you på din dator. Du kan prova olika themes och tillägg till WordPress, testa deras funktioner och lära dig grunderna i WordPress.

Om du redan har en WordPress-webbplats kan du skapa en lokal kopia av din website på din dator för att prova nya tillägg updates innan du implementerar dem på din live website.

Viktigt: En språkversion av en website kommer bara att vara synlig för you på din dator. Om du vill skapa en live website behöver du ett domain name och ett webbhotell i WordPress.

Följ Step-by-Step-instruktionerna i vår guide om hur du startar en blogg i WordPress när du är redo att skapa en live website.

Med detta sagt, låt oss kontrollera hur du installerar WordPress lokalt på Windows, Mac eller Linux med hjälp av XAMPP.

Vad är XAMPP?

XAMPP är ett programpaket som innehåller allt du behöver för att skapa en lokal servermiljö på din dator.

För att kunna skapa en lokal WordPress site måste du installera en web server (Apache), PHP och MySQL på din dator.

PHP är ett programmeringsspråk och MySQL är en programvara för hantering av databaser. Båda dessa är obligatoriska för att WordPress ska kunna runna.

Att installera dem separat är ganska svårt för Beginnare. Det är här XAMPP kommer in i bilden.

XAMPP gör det enkelt för dig att bygga WordPress websites lokalt. Det är tillgängligt för datorer som är baserade på Windows, Mac och Linux.

Låt oss komma igång genom att installera XAMPP och ställa in den för att run din lokala WordPress site.

Installera XAMPP på din dator

Först måste du besöka XAMPP:s website och klicka på knappen ”Download” för ditt operativsystem.

Download XAMPP to your computer

Beroende på ditt operativsystem kan din installationsguide (Wizard) och programgränssnittet skilja sig från screenshots här. I den här artikeln kommer vi att visa dig Windows-versionen av programvaran.

När du har downloadat XAMPP måste du clicka och runna installatören.

XAMPP set up wizard

XAMPP kommer att fråga var programvaran ska installeras och vilka paket du gillar att installera. Standardinställningarna kommer att fungera för de flesta användare. Fortsätt clicka på knappen ”Next” för att slutför Setup Wizard.

När du har slutfört Wizard kontrollerar du alternativet ”Starta kontrollpanelen nu” och klickar sedan på knappen ”Finish”.

Finish set up and launch XAMPP control panel

Detta kommer att starta appen XAMPP Control Panel.

Med appen XAMPP kan du köra web servern Apache som din lokala server och MySQL som din database server. Gå vidare och klicka på knappen ”Start” bredvid både Apache och MySQL.

Start Apache and MySQL to launch your local server

XAMPP kommer nu att starta Apache och MySQL.

Du kanske ser en notification från Windows firewall. Det är viktigt att du klickar på knappen ”Allow Access” för att båda programmen ska kunna köras på din dator.

Allow firewall access to Apache and MySQL

När båda programmen har startats kommer deras namn att markeras med grönt.

Nu är du redo att skapa en språkversion av din website och installera WordPress med hjälp av XAMPP.

Skapa en språkversion av en WordPress site med XAMPP

Först måste du downloada WordPress. Gå till webbplatsen WordPress.org och klicka på knappen ”Download WordPress”.

Download WordPress

När du har downloadat WordPress måste du extrahera zip-filen, så ser du en wordpress folder.

You need to copy this folder.

WordPress folder

Därefter, head över till din XAMPP installations folder.

I Windows är det C:/Program Files/XAMPP/htdocs eller C:/Xampp/htdocs.

På Mac kommer det att vara /Applications/XAMPP/htdocs.

Klistra in wordpress-mappen som du kopierade tidigare i mappen ”htdocs”.

Vi rekommenderar att du byter namn på ”wordpress”-foldern till ”website” eller något annat. Detta hjälper dig att enkelt identifiera din språkversion av din site.

Rename WordPress folder

Därefter måste du öppna din favorit web browser.

Du kan enter följande URL i adressfältet i din webbläsare:

https://localhost/website1/

Om du har bytt namn på WordPress-mappen till något annat, se till att du ersätter ”website1” med ditt eget namn på mappen.

Detta kommer att hämta installationsguiden för WordPress och du kommer att bli ombedd att selecta ett språk. När du har valt språk klickar du på knappen ”Fortsätt”.

Select language

På nästa vy ser du välkomstskärmen för WordPress.

Det innehåller en notice om att WordPress behöver ett databasnamn, databasens användarnamn, password och information om server.

WordPress installation requirements

Nu ska vi skapa en database för din site WordPress.

Du måste öppna en new tabs i webbläsaren och besöka https://localhost/phpmyadmin/.

Detta kommer att starta phpMyAdmin app som levereras förinstallerad med XAMPP. Den allow you att enkelt hantera your databases med hjälp av ett enklare gränssnitt.

You need to click on ”Databases” and provide a name for your new database. Därefter klickar du på knappen ”Create” för att fortsätta.

Creating a database for your local WordPress site

Nu när du har skapat en database kan du använda den för din WordPress site.

Gå tillbaka till tabben /localhost/website1/ i webbläsaren och klicka på knappen ”Let’s Go”.

På nästa vy kommer du att bli ombedd att ange din WordPress database information.

Enter namnet på databasen som du skapade tidigare. Your användarnamn är ’root’ och du bör lämna fältet för password tomt. I fältet för databasens server måste du använda localhost.

Enter your WordPress database information

När du är klar klickar du på knappen ”Submit” för att fortsätta.

Om du använder Windows eller Linux kommer WordPress nu att lagra dessa settings i din WordPress-konfigurationsfil som heter wp-config.php.

Men om du använder en Mac kommer den att visa dig innehållet i filen och be dig att skapa den.

You will need to create this file in your website’s root folder.

När du har skapat filen klistrar du in texten som du kopierade tidigare i den. Därefter måste du save filen och gå tillbaka till WordPress installer för att fortsätta.

I nästa steg kommer WordPress att be dig att ange information om din website. Först ska du enter den Rubrik som du vill använda för denna site.

Efter det måste du enter ett användarnamn, password och email address för ditt admin account.

Enter your local site information

När du har fyllt i all information klickar du på knappen ”Install WordPress” för att fortsätta.

WordPress kommer nu att köra installationen och uppmana dig att logga in när den är klar.

Du kan logga in på din website genom att gå till /localhost/website1/wp-admin page och använda användarnamnet och password som du enter under installationen.

WordPress login page

Saker att prova efter att ha skapat en lokal site i WordPress

Nu när du har skapat din lokala WordPress site med XAMPP kan du arbeta med den på samma sätt som med en live WordPress site.

Head över till menyn Appearance i admin sidebar i WordPress för att customize din sites appearance eller installera ett new tema.

Här är några bra gratis themes som du kan prova.

Nästa sak du skulle vilja prova är att installera några tillägg till WordPress.

Plugins är som appar för din WordPress site och allow you to add cool features like a contact form, social media buttons, an eCommerce store, and much more.

Behöver du hjälp med att installera tillägg? Se vår Step-by-Step guide om hur du installerar ett tillägg till WordPress.

Bonus: Flytta en lokal site i WordPress till en Live Server

Efter att ha arbetat på din lokala WordPress site kanske du vill flytta den till en live server för att skapa din första WordPress blogg eller website.

För att göra det behöver du ett domain name och ett webbhotell account. Normalt kostar ett domain name $14.99, och webbhotell börjar på $7.99 per månad.

Det är för mycket om du precis har börjat.

Lyckligtvis erbjuder Bluehost WPBeginners användare ett gratis domain name med en generös rabatt på webbhotell. I grund och botten kan du komma igång för $1,99 per månad.

För fler rekommendationer om webbhotell, ta en titt på vår kompletta WordPress hosting guide.

När du har registrerat dig för ett webbhotell kan du följa vår Step-by-Step guide om hur du flyttar WordPress från en lokal server till en live site.

Du kanske också vill klura på alternativa sätt att skapa lokala WordPress webbplatser på Windows med hjälp av Wampserver och på Mac med hjälp av MAMP.

Expertguider om lokala webbplatser WordPress

Nu när du vet hur man skapar en lokal WordPress site med XAMPP, kanske du gillar att se några andra guider relaterade till lokala WordPress installationer.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du skapar en lokal site med WordPress med hjälp av XAMPP. Du kanske också vill se vår guide om varför du ska använda WordPress för din website eller våra expertval för de bästa gratis webbhotellen.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

178 kommentarerLämna ett svar

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. André Bruwer

    Hi there WPBEGINNER SUPPORT

    Great article thank you :)

    I was wondering… is it better to develop a wp website for a client live or better to build it locally then transfer it to the hosted wp site with duplicator or something similar?

    Any advise would be greatly appreciated. Can’t figure this one out.

    Thanks
    André

      • demola

        pls i want to move my wordpresite from my laptop to another laptop i use xamp as a local server

  3. Thomas James Keely

    I was up and running within minutes. Thank you so much!!!

  4. Chaitra

    Hi, I am getting following error when I connect to localhost/website1
    You don’t have permission to access /website1/ on this server.
    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

  5. Chaitra

    Hi, I get the following error when I access localhost/website1 –
    You don’t have permission to access /website1/ on this server.
    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

  6. Jay

    your article is very helpful for wp beginner.

  7. rocky

    Thanks for the Knowledge but how can i make it live through Xampp. Let us know if theres any tutorial

    • bala

      yes there is a way to put your localhost online, you should redirect your domain name to your computer’s ip address

  8. Jojo

    Hi,
    I followed your tutorial and created a wordpress site. How can I create another local wordpress site with this setup?

  9. sekar ramu

    Thanks. Simple and Straightforward

  10. Eleazar

    Hi Guy. Your tutorial is very straightforward. I liked it. Very clear and easy to follow. Tkanks

  11. Jerry

    Very straight forward tutorial! Thank you.

  12. krishan pal singh

    Very helpful tutorial for me… Thank you so much :)

  13. paul

    hi, i have been able to login to wordpress using xampp, but when i click on the themes area i only see three themes. when i try to install a new theme, im notified that there is an error. please i need your help.

  14. Shamrat Hossain

    This article was really helpful for me . Hope You will be doing good works like this for us in future ..

    Thanks

  15. Abhijith

    Hi Team

    I have problem with xampp server once installation itz working fine after shutdown if am going to using again in the xamm server buttons not working
    it asking again and again tomcat file….please let me know how to fix it

  16. Suraj Barthwal

    you’r article was really helpful. i do have a query for you though, what should i do if i wanted to extract my wordpress live website so i could use it in future.

  17. Mario Bergeron

    Hi,

    Thanks for your article really helpful. Everything works fine, installation etc., but I try to install a theme on my WP and i got this message ”The uploaded file exceeds the upload_max_filesize in php.ini.” What can I do to install my theme??

    Thank you to help me.

    Mario Bergeron

  18. JERSon

    Hi ALL,

    im stuck at localhost/website1 …it will give the error page

    This site can’t be reached
    localhost refused to connect.
    Search Google for localhost website1
    ERR_CONNECTION_REFUSED

    Please help

    • Innocent

      Make sure your apache and mysql is running. Then try again

  19. Emmanuel

    Hello WordPress, I have installed and used Xampp yesterday and it worked very fine but whike trying to open and use it today, its taking back to the installation process and asking for a new storage location. How do I go about this?

  20. ayush singh chauhan

    Sir , when i try opening localhost/website1
    then something else opens which is not similar to yours.
    that is showing index of website ..
    what should i do now

  21. Stanley

    When I finish with a website and wish to build another different website, how do I go about it? Thanks.

    • WPBeginner Support

      Hi Stanley,

      Create a new folder for your website inside htdocs folder and repeat all the steps mentioned under ’Creating a Local WordPress Site with XAMPP’ section.

      Administratör

  22. Jonathan Pienaar

    Great tutorial, and works 99% for Linux. (I had to create wp-config.php manually for some reason).

    Only other issue: trying to use the Elementor Page Builder plugin, but it requires an FTP login/password. Tried starting FTP server, but can’ figure out how to configure it so that I can give Elementor FTP access/download the plugin.

    (Hope this makes sense).

  23. Bhagwat Pawar

    nice and practically perfect. can i add email functionality here installing gmail smtp or wp smtp plugin

  24. Jane

    This was so easy to follow. Thank you very much,

    When I want to upload a theme in my new wordpress I get this error: ‘The uploaded file exceeds the upload_max_filesize directive in php.ini.’

    Can I do anything about this?

  25. Kumar

    Thank you! Wonderfully detailed step-by-step instructions. Was able to install WordPress on my local machine without a problem. Much appreciated.

  26. Julie

    I am having the same problem James had:
    Hi! I have successfully installed my xamp server, wordpress and database. My question is, after logging in to wordpress, I cannot see any dashboard panel wherein I can edit my themes and install plugins. Please help! Thanks.

    Has anyone found a solution?
    Thanks!

  27. Eleonro

    Hi, I have issues at login, when I try to log on, wp server says its invalid, what can I do?

  28. James

    Hi! I have successfully installed my xamp server, wordpress and database. My question is, after logging in to wordpress, I cannot see any dashboard panel wherein I can edit my themes and install plugins. Please help! Thanks.

  29. Ruma

    when I am submitting my data base name,username and password it is saying try again i have written each and every thing right name

    • Kenny

      Leave the password space blank

  30. Dani

    To anyone having an issue with the localhost/website1 link not working, how I got it to work (on mac, might work for windows) was heading over to the Network tab in XAMPP and pressing enable. Then I took the port number (in my case it was localhost:8080) and then added that to the url. It looked like localhost:8080/website1.

    Good luck!

    • Maria

      Dani, Thanks so much for your post. I was having the same issue. After reading your post, I was able to get to the next step. few!

  31. Hillary

    I have set up the WordPress website, but yet i am still having issues upload some plugins that come with the themes i want to use. How do i get to correct this?
    Thanks

  32. Maheshwaran

    Thanks you so much.. Your step by step contents helps me lot.

  33. Nicholas

    Thanks you so much ..
    But i have faced one problem, after putting WordPress files into htdocs, i went to my browser and searched for ”localhost/WordPress ” and i got ” error 404 Object not found ” how can i please fix that problem?
    Thanks

    • Amokola Stephen

      Did you start services in your local server(xamp)? if not please navigate xamp control panel and make sure that you start apache and mysql services

  34. Alexander

    I really like your post, thank you for sharing such a great post. Setting up wordpress website on localhost using XAMPP is the best solution you have. It gives you an option to explore themes and plugins as well. When i was researching how to work on localhost i have found two great resources through which anyone can easily learn to launch wordpress using localhost.
    https://www.wpbeginner.com/wp-tutorials/how-to-create-a-local-wordpress-site-using-xampp/

  35. Aligo

    Thank you very much for this article.. I really followed it and was successful in creating the website

  36. DavidA

    Thank you for this article — it is great to be able to work at the website locally before exposing it to the world.

    Is it possible to have more than one website locally? I have another site that I need to modify/see locally. How would I add this to the other without getting them mixed?

    Thank you

    • WPBeginner Support

      Hi,

      You can add more websites by simply adding a new folder under /XAMPP/htdocs/.

      Administratör

      • DavidA

        Thank you – the WPBeginners site/articles/support team have been a God-send.
        Please keep doing what you are doing!(:0)!

      • Stanley

        Thanks at WP team. I added another WordPress folder and it’s not working. I named this second folder WordPress1 since the first site database is WordPress and it didn’t work. Please, do help. Thanks.

        • WPBeginner Support

          Hi Stanley,

          Do you see an error when you visit the website in your browser?

  37. Trifina

    For Mac users you recommended:

    ”You will need to create this file in your website’s root folder.”

    Can you elaborate? Where can i find this folder?

    • WPBeginner Support

      Hey Triffina,

      Normally, your XAMPP website folders are stored in /Applications/XAMPP/xamppfiles/htdocs/ folder.

      Administratör

  38. Ann

    followed all the steps but when i put ”localhost/website1”, it shows an error saying ”Error establishing a database connection”, also tried restarting my xampp, yet still the same problem exist.

  39. Mike

    Get an Object not found message when I put the localhost/website1 in my browser. It reads the following:

    Error 404

    localhost
    Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30

    Any ideas guys?

    Thanks

  40. Chris

    good afternoon,
    thank you for your article. It was easy to follow. I have managed to install WP offline on my pc but I cannot figure out how to login to wp-admin and start working offline.
    I know you mentioned that we should login at /localhost/etc…. but where do I enter that? do I open it on my browser?

    thank you

    • WPBeginner Support

      Hi Chris,

      Yes, you will need to enter that in your browser’s address bar.

      Administratör

  41. Amy

    Hi, thanks for this great tutorial.
    I need to update the php.ini as I am getting the error ’The uploaded file exceeds the upload_max_filesize directive in php.ini.’ how do I find this on localhost ?
    Thanks!

  42. Ratnesh Tripathi

    Great article sir, but I am not able to login into WordPress admin panel.
    Please provide solution

  43. Mike

    am not getting the welcome to word press page what’s wrong, it’s got — Index of /website1 —at the top

  44. abdulmuluq

    please it showing me database not found when I try to input database name in my wp

    • sam

      Yeah, It happened to me too. You’ve gotta create your database name in the localhost/phpMyAdmin section in your browser before going back to fill the pieces of information and also the username will be root and the password will be empty. You’re good to go

  45. divp

    Good one thanks for sharing

  46. Raymart

    Which is much faster, XAMPP or WAMP?

  47. Shaedar

    Thanks for the detailed guide… i followed the steps as outlined above an it all worked out well until i tried to launch wordpress on my browser by entering ”localhost/website1” Instead of launching, its showed ”Index/website1”
    please what could be the problem?

    • WPBeginner Support

      Hi Shaeder,

      Try to restart XAMPP, make sure you copied the WordPress folder and the website1 folder actually contains your WordPress files.

      Administratör

      • Shaedar

        Thanks so much… working perfectly now.

  48. Rodney Lacambra

    Having a local WordPress site is great hence testing functionality, plugins, and themes before making it live.

    It’s also much faster compare to live.

    Thanks, great article.

  49. Paul Guzman

    This worked to perfection. Can’t believe I actually did this. Instructions were ”Right On”. This made my day!

  50. Soham Pratap

    Much creative way to just design put up the content … experiment and when you are done!! get your site online

  51. Om

    What about Wampserver is it the same ?

    • WPBeginner Support

      WAMPserver is also an Apache distribution maintained by different folks. But yes it also allows you to create local WordPress sites on your Windows computer.

      Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.