Welcome Guest, Not a member yet? Register   Sign In
php webserver works, apache2 doesn't
#1

Hi,



I'm working my way through the tutorial at https://codeigniter.com/user_guide/tutorial/index.html and am stuck.



My environment is a fresh install of raspbian on a pi-4 (10.0.0.17) which I'm accessing from my windows 10 desktop.



This is what I've done.


# get composer from https://getcomposer.org/download/
mv composer.phar composer
cd /var/www/html
~/composer create-project codeigniter4/appstarter gallery

# Set document root
vim /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html/gallery/public
# enable .htaccess
vim /etc/apache2/apache2.conf
# in '<Directory /var/www/>' change:
AllowOverride None
# to:
AllowOverride All
# then
systemctl restart apache2

# enable writable writable
cd /var/www/html/gallery
find writable/ -type d -print | xargs chmod 777
find writable/ -type f -print | xargs chmod 666

# set development mode
cp env .env
vim .env
CI_ENVIRONMENT = development

# setup for remote use on port 80
vim app/Config/App.php
# change:
public $baseURL = 'http://localhost:8080/';
# to your url
public $baseURL = 'http://10.0.0.17/';

# starting the custom php web server
systemctl stop apache2
cd /var/www/html/gallery
php spark serve --host 10.0.0.17 --port 80


It seems to work correctly when I use 'php spark serve' in that I can get the home page at http://10.0.0.17/home.



But when I switch to apache http://10.0.0.17/home shows just the text 'index.php', just exactly those letters.



The home page is shown if I access it via [font=Tahoma, Verdana, Arial, sans-serif]http://10.0.0.17/index.php/home. From this forum, I think that suggests a problem with .htaccess in /public. In particular RewriteBase, but I can't work out what's wrong. /public/.htaccess so it still has RewriteBase commented out although I have experimented with various values in there like '/' and '/public' with no success.[/font]

[font=Tahoma, Verdana, Arial, sans-serif]Any suggestions welcome![/font]

[font=Tahoma, Verdana, Arial, sans-serif]Cheers,[/font]
[font=Tahoma, Verdana, Arial, sans-serif]Pete [/font]
Reply
#2

It was mod_rewrite. This fixed it

a2enmod rewrite
Reply




Theme © iAndrew 2016 - Forum software by © MyBB