質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

CodeIgniter

CodeIgniterは、PHP向けオープンソースのWebアプリケーションフレームワークです。CodeIgniterは覚える構文が少なく、自由度も高いため、PHPを理解していれば構築が簡単です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

0回答

459閲覧

vagrantでcodeigniterの環境構築をする

nabex

総合スコア66

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

CodeIgniter

CodeIgniterは、PHP向けオープンソースのWebアプリケーションフレームワークです。CodeIgniterは覚える構文が少なく、自由度も高いため、PHPを理解していれば構築が簡単です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2019/03/03 11:13

編集2019/03/03 11:49

vagrantでcodeigniterの環境構築をしたいです。

以下のサイトを参考にしながら Codeigniterの環境構築を行ったのですが、CodeIgniterの「Welcome」ページが表示されず、Apacheのテストページが表示されます。

Apacheのテストページではなく、Codeigniterのwelcomeページをまず表示させたいです。

環境構築のやり方についてはこちらのサイトを参考にさせて頂きました。

CodeIgniterの開発環境をvagrant-centos6-phpを使い構築する
http://blog.a-way-out.net/blog/2014/12/02/install-codeigniter-with-vagrant/

私の使用環境のOSはwindows8です。
手順にある通り、virtualBoxとVagrantとCodeIgniterはインストール済みです。

以下の実行手順を試したのですが、Codeigniterのwelcomeページを表示させるにはどのようにしたら良いのでしょうか。

実行手順
① C:\Users\user\ユーザー名のディレクトリにサイトに記載されているURLからダウンロードしたCodeigniterを置く。
(フォルダ名をCodeIgniter-developに変更)

② vagrant-centos6-phpも同じようにサイトのURLから落として解凍し、CodeIgniter-developの直下に置く

③ vagrantファイルの編集
「#chef.add_recipe "codeigniter"」の「#」を削除し、保存

④ vagrant upを実行

⑤ windowsではコマンドプロントでvagrant sshの接続が打てないので、tera termを使って仮想環境に接続

接続の方法はこちらのサイトを参考
https://qiita.com/tomarigi2170/items/789f8d8c71f0e9dc420a

⑥ tera termでSSH接続
$ sudo yum -y install httpdのコマンドを実行
webサーバーをインストール

⑦ $ sudo /sbin/service httpd startのコマンドを実行

以上の手順を実行後、http://localhost:8000/にアクセスすると、Apacheのテストページが表示されます。

サイトではcodeigniterのwelcompageが表示されるとあるのですが、表示されません。何かやり方を間違えていますでしょうか。

よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Stan_Dma

2019/03/03 13:26

I am afraid you should not install apache-httpd by yourself according to the reference site.
nabex

2019/03/04 05:48

It certainly did not write on that site, but I thought that I needed it. Am I wrong?
Stan_Dma

2019/03/04 06:04

I am sorry you might be wrong. You dont need to install it because the vagrant-centos6-php is distributed with apache-HTTPD including, see https://github.com/kenjis/vagrant-centos6-php and also the reference URL shows it near the end. Your HTTPD settings may be overwritten by new installation of it.
nabex

2019/03/04 14:40

Thank you! I see. I did not need it because it was already in there. But,is it necessary to connect with vagrant ssh and install codeigniter with composer? I want to display the welcome page of code igniters. Because it could not do it with this procedure.
Stan_Dma

2019/03/05 04:30

I am very sorry I am totally wrong! I have just tried with the vagrant-centos6-php virtual environment and I see that it has not apache, php or else installed, by default. I could not understand its documentation on https://github.com/kenjis/vagrant-centos6-php and also your reference site. Then I managed to succeed to display the 'Welcome to CodeIgniter!' page as following: (each in VM except last one) execute 'yum install centos-release-scl' (because of an error happened), 'yum install httpd', 'yum install php', edit /etc/httpd/conf/httpd.conf to set 'DocumentRoot=/mnt/project' (by default, it's 'DocumentRoot=/var/www/html'), reboot httpd process (/etc/rc.d/init.d/httpd restart), and at last access http://localhost:8000 via my browser on my host PC. This should be not enough to use codeigniter environment, just only to get welcome page. Good luck!
nabex

2019/03/05 15:33

Thank you! Dont ,mind. I connected with vagrant ssh and put codeigtiter in the directory of / home / vagrant / codeigtiter. In that case, is the document route setting '/ home / vagrant / codeigniter / public' correct? And I also ran the 'sudo / sbin / service httpd restart' command. However, why the document route is not reflected. Probably not changed as default '' var / www / html. Because index.html written 'hello world' there is displayed. Does the URL match 'http: // localhost: 8000 /'?
Stan_Dma

2019/03/05 23:56 編集

First of all, the site you have referred is a little bit outdated, so you should know the installation steps shown would not be adequate now. You could find a index.php in the /mnt/project directory, not in /home/vagrant/codeigniter/public, right? Then that's it. You have DOCUMENT_ROOT in the httpd.conf to be set definitely to /mnt/project. You know /mnt/project directory is mounted to the codeigniter top directory existed on your host PC.
nabex

2019/03/06 13:21

The welcome page was displayed, thank you very much! I also understood that the information on that site is old. In the place of '/ home / vagrant /', wrongly installed codeigniter with composer and set it as document root. Because I did not know the existence of / mnt / project. If you have the opportunity, please tell me again. Thanks to you I was saved very much.
nabex

2019/03/06 13:38

I would like you to choose 'Best answer' according to terateil's rule. However, you can not do it from me because you misunderstood comments for each place. The place where you wrote a comment is because it is the field of request for additional questions. If you do not mind, please add a comment from the green button. That button is written with 「あなたの回答」in Japanese. In English you mean your answer. That way, I can pick you as 'best answer'.
Stan_Dma

2019/03/06 13:43

I appreciated. Also no thank you for giving me a good answer because it is my way.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問