おそらくapache2の設定があっていないと思うのですが、公式bookを読んでもわからず、質問させていただきました。
アクセスしてhellow World!を表示させたいアドレス
http://localhost/cakephp3/cart/hello
表示されてしまう文
Not Found The requested URL /cakephp3/cart/hello was not found on this server. Apache/2.4.18 (Ubuntu) Server at localhost Port 80
やったこと
touch HelloController.php vim HelloController.php cd /etc/apache2 vim apache2.conf
apache2.confの中身を編集
<Directory /var/www> Options Indexes FollowSymLinks MultiViews AllowOverride All Order Allow,Deny Allow from all </Directory>
sudo a2enmod rewrite sudo service apache2 restart
HelloControllerの中身
php
1<?php 2namespace App\Controller; 3 4class HelloController extends AppContoroller { 5 public $name = 'Hello'; 6 public $autoRender = false; 7 public function index() { 8 echo "hello world!"; 9 } 10}
対象ファイル
linux
1/var/www/html/cakephp3/cart/src/Controller$ ls 2AppController.php ErrorController.php PagesController.php 3Component HelloController.php
追加事項
Documentrootを/var/wwwから/var/www/htmlに書き換え、サーバを再起動したのですが、同じようにエラーになってしまっております。
vim /etc/apache2/apache2.conf 164 <Directory /var/www/html> 165 Options Indexes FollowSymLinks 166 AllowOverride All 167 Require all granted 168 </Directory> sudo /etc/init.d/apache2 restart

回答2件
あなたの回答
tips
プレビュー