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

XAMPPを使ってローカルWordPressサイトを作成する方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

WPBeginnerチームは、定期的にコンピューター上にローカルWordPressサイトを作成し、本番サイトに影響を与えることなく、テーマ、プラグイン、サイトの機能をテストしています。

XAMPPは、ローカルのWordPressインスタンスをセットアップするためのユーザーフレンドリーなプラットフォームを提供する、フリーでオープンソースのソフトウェアパッケージです。

この投稿では、XAMPPを使用して簡単にローカルのWordPressサイトを作成する方法を紹介し、安全な環境でWordPressを試したり、開発者のスキルを磨いたりできるようにします。

Creating local WordPress install using XAMPP

なぜローカルWordPressサイトを作るのか?

ローカルWordPressサイトの作成は、開発者やサイトオーナーの間では一般的な手法です。インターネット上に実際のサイトを作成することなく、WordPressをテストすることができます。

ローカルサイトは、コンピューター上でしか見ることができません。さまざまなWordPressテーマやプラグインを試したり、機能をテストしたり、WordPressの基本を学んだりすることができます。

すでにWordPressのウェブサイトをお持ちの場合は、コンピュータ上にウェブサイトのローカルコピーを作成し、本番のウェブサイトにプラグインを実装する前に、新しいプラグインの更新を試すことができます。

重要:ローカルサイトは、あなたのコンピューター上でしか見ることができません。ライブサイトを作りたい場合は、ドメイン名と WordPressホスティングサービスが必要です。

ライブサイトを作成する準備ができたら、WordPressブログの始め方ガイドのステップバイステップの指示に従ってください。

それでは、XAMPPを使ってWindows、Mac、LinuxにWordPressをローカルインストールする方法を紹介しましょう。

XAMPPとは何ですか?

XAMPPは、コンピューター上にローカルサーバー環境を構築するために必要なものがすべて含まれているソフトウェアパッケージです。

ローカルのWordPressサイトを作成するには、コンピューターにWebサーバーソフトウェア(Apache)、PHP、MySQLをセットアップする必要があります。

PHPはプログラミング言語であり、MySQLはデータベース管理ソフトウェアである。WordPressを動かすには、この2つが必須です。

これらを区切りインストールするのは初心者にはかなり難しいです。そこでXAMPPの登場です。

XAMPPを使えば、WordPressサイトをローカルで簡単に構築できます。Windows、Mac、Linuxベースのコンピューターでご利用いただけます。

さっそくXAMPPをインストールし、ローカルのWordPressサイトを実行するように設定しましょう。

コンピューターへのXAMPPインストール

まず、XAMPPのサイトにアクセスし、お使いのOSの「Download」ボタンをクリックしてください。

Download XAMPP to your computer

お使いのオペレーティング・システムによっては、インストール・ウィザードやアプリケーション・インターフェースがここに掲載したスクリーンショットと異なる場合があります。この投稿では、Windows版のソフトウェアを紹介します。

XAMPPをダウンロードしたら、インストーラをクリックして実行します。

XAMPP set up wizard

XAMPPはソフトウェアのインストール先とインストールしたいパッケージを聞いてきます。ほとんどのユーザーは初期設定で問題ありません。そのまま「Next」ボタンをクリックしてセットアップウィザードを終了してください。

ウィザードが終了したら、’start the control panel now’ オプションをチェックし、’Finish’ ボタンをクリックする。

Finish set up and launch XAMPP control panel

これでXAMPPコントロールパネルアプリが起動します。

XAMPPアプリを使用すると、Apache Webサーバーをローカルサーバーとして、MySQLをデータベースサーバーとして実行することができます。ApacheとMySQLの隣にある「Start」ボタンをクリックしてください。

Start Apache and MySQL to launch your local server

XAMPPはApacheとMySQLを起動します。

Windowsファイアウォールの通知が表示される場合があります。両方のアプリケーションをコンピューター上で実行するには、「アクセスを許可」ボタンをクリックすることが重要です。

Allow firewall access to Apache and MySQL

両方のアプリケーションが起動すると、名前が緑色にハイライトされます。

これで、XAMPPを使ってローカルサイトを作成し、WordPressをインストールする準備ができました。

XAMPPでローカルWordPressサイトを作る

まず、WordPressをダウンロードする必要があります。WordPress.orgのサイトにアクセスし、「Download WordPress」ボタンをクリックします。

Download WordPress

WordPressをダウンロードした後、zipファイルを解凍すると、WordPressフォルダーが表示されます。

このフォルダーをコピーする必要がある。

WordPress folder

次に、XAMPPのインストールフォルダーに移動します。

Windowsでは、C:/Program Files/XAMPP/htdocsまたはC:/Xampp/htdocsとなります。

Macでは、/Applications/XAMPP/htdocsとなります。

先ほどコピーしたWordPressフォルダーを「htdocs」フォルダー内に貼り付けます。

WordPress’フォルダーの名前を’サイト’などに変更することをお勧めします。こうすることで、ローカルサイトを簡単に識別できるようになります。

Rename WordPress folder

次に、お気に入りのウェブブラウザーを開く必要がある。

以下のURLをブラウザーのアドレスバーに入力してください:

https://localhost/website1/

WordPressフォルダーの名前を他の名前に変更した場合は、’website1’を自分のフォルダー名に置き換えてください。

WordPressのインストール・ウィザードが起動し、言語の選択を求められます。言語を選択したら、「Continue」ボタンをクリックします。

Select language

次の画面では、WordPressのウェルカム画面が表示されます。

WordPressがデータベース名、データベースのユーザー名、パスワード、ホスティングサービスを必要としていることが表示されます。

WordPress installation requirements

WordPressサイトのデータベースを作成しましょう。

新しいブラウザータブを開き、https://localhost/phpmyadmin/。

これで、XAMPPにプリインストールされているphpMyAdminアプリが起動します。よりシンプルなインターフェースでデータベースを簡単に管理することができます。

データベース」をクリックし、新規データベースの名前を入力します。その後、「Create」ボタンをクリックして続行します。

Creating a database for your local WordPress site

これでデータベースが作成できたので、WordPressサイトで使用することができます。

localhost/website1/ブラウザータブに戻り、「Let’s Go」ボタンをクリックする。

次の画面では、WordPressデータベース情報の入力を求められます。

先ほど作成したデータベース名を入力する。ユーザー名は’root’で、パスワード・フィールドは空白にしておく。データベースのホスティングサービス欄には、localhostを使用する必要があります。

Enter your WordPress database information

入力が終わったら、「送信」ボタンをクリックして次に進みます。

WindowsまたはLinuxをお使いの場合、WordPressはこれらの設定をwp-config.phpというWordPressの設定ファイルに保存します。

しかし、Macを使用している場合は、ファイルのコンテンツが表示され、そのファイルを作成するよう求められます。

このファイルはサイトのルート・フォルダーに作成する必要があります。

ファイルを作成したら、その中に先ほどコピーしたテキストをペーストする。次に、ファイルを保存し、WordPressインストーラに戻って続行する必要があります。

次のステップで、WordPressはあなたのサイトに関する情報を提供するよう求めます。まず、このサイトに使用するタイトルを入力します。

その後、管理者アカウントのユーザー名、パスワード、メールアドレスを入力する必要があります。

Enter your local site information

すべての情報を入力したら、「WordPressをインストール」ボタンをクリックして続行します。

WordPressはインストールを実行し、完了したらログインするよう促します。

localhost/website1/wp-adminページにアクセスし、インストール時に入力したユーザー名とパスワードを使用してログインすることができます。

WordPress login page

ローカルWordPressサイト作成後に試すべきこと

XAMPPを使ってローカルのWordPressサイトを作成したら、本番のWordPressサイトと同じように作業することができます。

WordPress管理画面のサイドバーにある外観メニューから、サイトの外観をカスタマイズしたり、新しいテーマをインストールすることができます。

ここでは、あなたが試すことができるいくつかの素晴らしい無料のテーマを紹介します。

次に試したいのは、WordPressプラグインのインストールだ。

プラグインはWordPressサイトのアプリのようなもので、お問い合わせフォーム、ソーシャルメディアボタン、eコマースストアなどのクールな機能を追加することができます。

プラグインのインストールでお困りですか?WordPressプラグインのインストール方法については、ステップバイステップのガイドをご覧ください。

ボーナス:ローカルWordPressサイトをライブサーバーに移動する

ローカルのWordPressサイトで作業した後、それをライブサーバーに移動して、初めてのWordPressブログやウェブサイトを作りたいと思うかもしれません。

そのためには、ドメイン名とホスティングサービスが必要です。通常、ドメインネームは14.99ドル、サイトホスティングサービスは月額7.99ドルから。

まだ駆け出しなら、それはやりすぎだ。

幸いなことに、BluehostはWPBeginnerユーザーにドメイン名を無料で提供し、ホスティングサービスを大幅に割引している。基本的に、月額$1.99で始めることができる。

その他のホスティングサービスについては、WordPressホスティングガイドをご覧ください。

ホスティングサービスにサインアップしたら、WordPress をローカルサーバーからライブサイトに移行する方法をステップバイステップで説明します。

また、WindowsではWampserverMacではMAMPを使ってローカルWordPressサイトを作成する方法もあります。

ローカルWordPressサイトのエキスパートガイド

XAMPPを使ってローカルWordPressサイトを作成する方法はおわかりいただけたと思いますが、ローカルWordPressインストールに関する他のガイドもご覧ください。

この投稿で、XAMPPを使ってローカルWordPressサイトを作成する方法をご理解いただけたと思います。あなたのサイトにWordPressを使うべき理由や、専門家が選ぶ最高の無料ホスティングサービスもご覧ください。

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.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

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.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

178件のコメント返信を残す

  1. Syed Balkhi says

    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. Moinuddin Waheed says

    I have been using xampp for a long time and first time when I installed it , it was for running php code.
    I have also used it for wordpress local environment for understanding and developing websites locally.
    one thing that has bother me regarding wordpress installation is username and password.
    why we keep user as root and password blank?
    this is not the case for live servers though?

    • WPBeginner Support says

      It is not something that you would use for a live site but the username being root and the password being blank is the defaults for XAMPP. As your local site would only be active on your computer you do not need to change it for your local XMPP installation.

      管理者

  3. Jiří Vaněk says

    Sometimes I use XAMPP. The only problem I sometimes encounter is shared hosting, to which the website is migrated from localhost. The problem is that the PHP limits are not always set in the same way on the shared server, or even the PHP version does not match (on the local 8.x and on the server, for example, the old version 7.x). This can often cause a problem in the functionality of the website, which was debugged on a different PHP than the one on the server. That’s probably the only flaw.

  4. Donatas says

    Hi, I have used these Xampp instructions to create a server on a PC (Windows 10 Education N). Everything worked perfectly fine and it’s a very useful article. I stuck in one place because I thought the database credentials folder had to be manualy created on Windows the same way it has to be on a Mac but these steps were exclusively for Mac. Thanks a lot!

  5. Paul says

    After having created the database and entered the database connection details, hitting submit gets me this message “There has been a critical error on this website”. Checked everything twice, what should I do?
    Thank you for your attention.

    • WPBeginner Support says

      For a fresh install, you would want to check the error log for XAMP to help narrow down the specific reason.

      管理者

    • John says

      Error logs didn’t help. But, as it turns out, for some reason, the most recent version of Xampp caused the same “critical error” response to happen for me too. I ended up uninstalling that version and went with the previous version of Xampp and presto! It works.

  6. lee kent says

    Hello. If I were to follow these steps and then decide i wanted to make another site, How would you create a new website locally?

    • WPBeginner Support says

      You would create a new folder and database and install the site in the new folder.

      管理者

  7. priyanka says

    I’m getting this error
    Your server is running PHP version 5.6.3 but WordPress 5.5.3 requires at least 5.6.20.
    p/lease help

    • WPBeginner Support says

      It is saying you want to upgrade the PHP you are using for your site to remove that error.

      管理者

  8. tarun says

    I get the following error, when I run http://localhost/mysite/wp-admin/setup-config.php

    One or more database tables are unavailable. The database may need to be repaired.

    I tried to do global search for “WP-config” file in my xampp folder but just found “wp-config-sample”. though I added the below line in
    “wp-config-sample.php” file
    // define(‘WP_ALLOW_REPAIR’, true);

    not really sure what to do after that.

    • WPBeginner Support says

      You would want to open phpMyAdmin and run the repair on all of your tables and if that does not work you would need to reach out to XAMPP’s support

      管理者

  9. tarun says

    I am not able to figure out why I am getting this strange error, though I tried to reinstall and connect several times, all I did was I tried to drop my existing database and tried to create a new wrodpress login but All I can see is the following error

    One or more database tables are unavailable. The database may need to be repaired.

  10. Mohsin Zubair says

    Hi Sir, I hope you are doing well. I am facing this error while creating data base.

    Error
    MySQL said: Documentation

    Cannot connect: invalid settings.
    phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

    • WPBeginner Support says

      You would want to check your configuration settings to see if it is set incorrectly.

      管理者

  11. David says

    This is exactly what I have been looking for: a local testing server to develop a website without signing up to a plan/paid service first.

    The explanations are brilliant and easy to follow. It’s genius! Many thanks.

  12. Ray Silva says

    I installed wordpress. Then I put the wordpress folder in xampp’s htdocs folder. When I go to localhost on my browser, I get sent to the xampp dashboard and welcome to xampp page.

    • WPBeginner Support says

      You may want to try localhost/foldername where foldername is the name of the folder where you placed WordPress to see if that is how it is currently set up.

      管理者

  13. Hussain Abbas says

    Hi

    My url to login to WordPress dashboard is coming as “/localhost/sitename/wordpress/wp-admin” whereas as per the above instructions it should be “/localhost/sitename/wp-admin” .

    Would request your help to know how can I remove “wordpess” from the link.

    Thanks

    • WPBeginner Support says

      For that, you installed the site in a folder named WordPress, if you are just starting out you can reinstall the site without the WordPress folder.

      管理者

  14. Darren Howes says

    Hi,
    Great instructions, complete novice, everything is working apart from when I try to add/upload images I get the the message

    Unable to create directory wp-content/uploads/2020/09. Is its parent directory writable by the server?

    I am working on a mac, any ideas on how to solve this?

    Regards
    Darren

    • WPBeginner Support says

      You would need to navigate to your XAMPP folder, right-click, and modify your sharing for that folder so that it can be updated.

      管理者

  15. marni says

    When setting up WordPress I used “admin” as the user name and changed the password supplied by WordPress. As a precaution I copied the supplied password. I cannot log in with either password (no typing errors).

  16. gaurav sachan says

    everything is done but database is not created so please me that why are not creting database in my php

  17. Dimitris says

    Hello after following the procedure after the following step:

    Next, you need to open your favorite web browser and visit localhost/website1. You will see a page like this:

    I get this message on the screen.

    Warning: require_once: failed to open stream: No such file or directory

  18. Muhammad Kamran Khan says

    after all these setting localhost/website1 started working. after shut down and restarted my laptop now when i go to localhost/website1/wp-admin/ error message came : This site cant be reached. localhost refused to connect.

  19. dilshan says

    This is really helpful because sometimes I want test some plugins but i dont want to install them to my website. I can try them in this local host site thanks to you

  20. Osazuwa says

    A very helpful tutorial.

    I have implemented them

    But on loading

    Localhost/website1

    it displays
    Parse error: syntax error, unexpected’.’ expecting ‘&’ or variable (T_VARIABLE) in C:\xampp\htcdocs\website1\wp-includes\functions.php on line 1081

    Thanks

    • WPBeginner Support says

      You would want to ensure the PHP you are using is up to date for the most common reason for that error.

      管理者

  21. Julio Talaverano says

    Hi,
    Yesterday I installed XAMPP and WordPress and I worked a bit on a new page using localhost/wordpress.
    I also installed some Plugins in WordPress.
    But today when put into the browser localhost/wordpress I just get the Page I created yesterday.
    Could you please tell me how I can continue editing my page with WordPress?
    Thanks

    • WPBeginner Support says

      If we’re understanding your question correctly, you would want to ensure XAMPP is running for your site to be visible when visiting the page.

      管理者

  22. Ronny says

    Hello,

    As always your tutorials are great. One question though. How do I make multiple localhosts using Xampp.

    Think of me as a noob the this. I’ve read a few other tutorials on the subject, but it seems they assume one would have some deeper understanding of processes.

    • WPBeginner Support says

      You would create a folder with a different name in the htdocs folder and follow the steps under the ‘Creating a Local WordPress Site with XAMPP’ section and navigate to the new site’s folder when you want to see the other site rather than your first site.

      管理者

  23. Anjuli says

    Hello! My browser cannot open to localhost after putting the WordPress folder to htdocs and renaming it to website1. What should I do? Thank you.

    • WPBeginner Support says

      If you’re returning to the site after a day, please ensure XAMPP is running on your computer for it to load porperly.

      管理者

  24. Zaid says

    I have a question if i am customizing my localhost wordpress site and my pc turned off. I will loss my site..?

    • WPBeginner Support says

      No, as long as you save your changes those saved changes will remain the next time you pull up your local installation

      管理者

  25. Carla says

    Guys, Just wanted to say thank you for this post! I successfully implemented a localhost on my computer thanks to your clear, step-by-step process outlined in the post! So excited to get practising my wp skills on this new installation!

  26. Victor says

    Great job!! Is there a way, or a tutorial to transfer an existing website to this service ? This one deals with a brand new one. I have a website, and I’d love to add it to XAMPP! Thanks ! :)

  27. Blessings Chibisa says

    Guys I installed WordPress on a local machine. Am using xamp server I created a database but they is a problem in connection of WordPress and the database…. What should I do ?
    Help me pliz

  28. Vikas says

    Great artice. It worked perfectly. I am a new learner. Sir could you guide me about How I could run multiple local sites using xampp.

    Any help will be aporeciated.

    • WPBeginner Support says

      You would want to create a new folder for the next site and then you should be able to follow the directions in the article to create a new database and site.

      管理者

  29. AASIMA says

    SIR.
    I successfully followed your instructions to make a website on the localhost. but the next day it doesn’t open and showing some error?

  30. Mate says

    Good guys

    I have my website running on local xampp server on windows 10 system I want to move to my new Mac pro computer how do I do it? thanks.

  31. Keith says

    I followed your directions and it was great, thanks.

    I am trying to upload the AVADA theme that I have install previously on Hostgator and it worked.

    It is 6mb and a zip file.

    When I try to add this theme I get this message: “The uploaded file exceeds the upload_max_filesize directive in php.ini”.

    Where am I going wrong? Thank You,

  32. Mary says

    Good evening, thanks for the great work done here. I have followed these steps and I am unable to log in to my website. All I am getting is this. I am feed up already. Connection for controluser as defined in your configuration failed.

    • WPBeginner Support says

      You would want to reach out to XAMPP’s support as there are multiple possible reasons from mysql not running to needing to reinstall xampp

      管理者

  33. Kashif Ch says

    Assalam o Alikum Sir!
    Currently, I am learning WordPress and want to build different websites like membership website, LMS, e-commerce store for learning best practices.
    Can we create two different websites using localhost or any other free hosting?

  34. Xander says

    I followed the steps and it worked perfectly yesterday.

    This morning, trying to connect to the localhost I received the following error:

    “This site can’t be reached localhost refused to connect.
    Search Google for localhost wordpress jack admin
    ERR_CONNECTION_REFUSED”

  35. Daniyal says

    Hello there,

    I’ve followed all the steps given in the article but stuck when I click “Install WordPress”, it gives me an error > “The site is experiencing technical difficulties”

    after setting Site Title, username, password, email.

    Can you help me, please :)

  36. haley says

    Thank you for this article. I am on the step where I need to open up the local site in a web browser but when I do, I get an error page saying “the local host has refused to connect.” I’m guessing I messed up on one of the former steps but I don’t know which one. I’m working on a Mac.

    Any guidance would be appreciated!

    • WPBeginner Support says

      If you are returning to the site you would want to ensure xampp is running when trying to view your local site

      管理者

  37. Charlie McCormack says

    Hi
    Thanks for this. Installation went 100%
    I am trying to test Divi which has to be loaded from a zip file
    I get this when I try to install it from aperance/upload theme
    The uploaded file exceeds the upload_max_filesize directive in php.ini.
    Any solutions would be great
    Charlie

  38. YINGLI says

    Hi, thanks for writing this article! :)

    I have a question though:
    I am at the step where I have to fill in a site title, username, password and email address for my admin account for WordPress. May I know whether the information that I use here should be the same as the information that I would use for my actual online WordPress account? I have an existing unlaunched WordPress site through Bluehost.

    Thanks so much! :)

    • WPBeginner Support says

      It is not required but if you’re creating a local site to test then it may be a good idea to set that as the same.

      管理者

  39. Karen says

    thanks for the great video. question. am i understanding the process correctly? 1) set up a test site (mysite1) But should i also set up a database/wp install for each client website that I build (and maintain)? I’m guessing yes. :)

  40. God's Son says

    Hi,i am very glad and grateful to you for this article. It was very simple and comprehensive,the photo illustrations helped me a lot. You are a great teacher,i hope i will be able to learn and share my knowlege with others like you soon,thanks.

  41. Aftab Hussain says

    Thanks for such a nice guideline. I have successfully install wordpress on my local computer by the help of this post.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。