CodeIgniter Forums
Running on Apache... whoops - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Running on Apache... whoops (/showthread.php?tid=74307)



Running on Apache... whoops - kcs - 09-08-2019

Hi, I have some apps built with CI3 working on my machine served by Apache, I am trying to run the CI4 starter app on Apache but I am stuck on the Whoops page without a clue. 
I installed the starter app via composer. Running it using the built in server functions well, I see the welcome page. But with Apache vhost, I can't find out what is wrong.

Here's my vhost:
Code:
<Directory "/Users/karine/Dev/ci4/public/">
Allow From All
AllowOverride All
Options +Indexes
Require all granted
</Directory>
<VirtualHost *:80>
        ServerName "local.ci4.com"
        DocumentRoot "/Users/karine/Dev/ci4/public"
</VirtualHost>


 In my env file:
Code:
CI_ENVIRONNEMENT = development
app.baseURL = 'local.ci4.com'

The mod_rewrite modele is loaded and I set the permissions on writable to 777 just to be sure.

Despite the development environnement, i don't see any log message that can help me figure out where the error is happening.  Huh
Thanks for your help


RE: Running on Apache... whoops - donpwinston - 09-08-2019

Did you rename the env file to .env? If so then you should not get the whoops page. You should get an informative error message.


RE: Running on Apache... whoops - dave friend - 09-08-2019

To be sure that the <Directory> directive is properly associated with the VHost put it inside the <VirtualHost> block, i.e.

Code:
<VirtualHost *:80>
        ServerName "local.ci4.com"
        DocumentRoot "/Users/karine/Dev/ci4/public"
        <Directory "/Users/karine/Dev/ci4/public/">
            Allow From All
            AllowOverride All
            Options +Indexes
            Require all granted
        </Directory>
</VirtualHost>

It can't hurt and will prevent "confusion" if there are any other <Directory> blocks in the server's config files.


RE: Running on Apache... whoops - kcs - 09-08-2019

Thank you both for the help
@Dave friend I moved the directory part just to be sure (but I did not see any change).
@donpwiston, I missed I had to rename .env here's what I get:

Quote:Fatal error: Uncaught TypeError:
Argument 1 passed to CodeIgniter\HTTP\URI:: setScheme() must be of the type string, null given, called in /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/HTTP/IncomingRequest.php on line 594 and defined in /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/HTTP/URI.php:624 Stack trace:
#0 /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/HTTP/IncomingRequest.php(594): CodeIgniter\HTTP\URI->setScheme(NULL)
#1 /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/HTTP/IncomingRequest.php(178): CodeIgniter\HTTP\IncomingRequest->detectURI('REQUEST_URI', 'local.ci4.com/')
#2 /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/Config/Services.php(609): CodeIgniter\HTTP\IncomingRequest->__construct(Object(Config\App), Object(CodeIgniter\HTTP\URI), '', Object(CodeIgniter\HTTP\UserAgent))
#3 /Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/Config/BaseService.php(119): CodeIgniter\Config\Serv in 
/Users/karine/Dev/ci4/vendor/codeigniter4/framework/system/HTTP/URI.php on line 624



RE: Running on Apache... whoops - dave friend - 09-09-2019

(09-08-2019, 11:10 PM)kcs Wrote: @Dave friend I moved the directory part just to be sure (but I did not see any change).

I'm sure you did it, but I'm going to say it anyway - you have to restart Apache after changing conf files.


RE: Running on Apache... whoops - kcs - 09-09-2019

(09-09-2019, 06:43 AM)dave friend Wrote:
(09-08-2019, 11:10 PM)kcs Wrote: @Dave friend I moved the directory part just to be sure (but I did not see any change).

I'm sure you did it, but I'm going to say it anyway - you have to restart Apache after changing conf files.

I did yes. Apache returns a 200 status code. (Thanks for checking).


RE: Running on Apache... whoops - kcs - 09-09-2019

I just resolved the issues I was having:

I added the http:// that were apparently missing for my base url in my .env file
Code:
app.baseURL = 'http://local.ci4.com'

With this I could finally see a nice debug screen with a clear message telling me
Code:
Cache unable to write to /Users/karine/Dev/ci4/writable/cache/

I had made the folder writable writable, but did not see there were some other folders in it... So changing the permissions on the cache folder made the trick Smile