picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.84k stars 614 forks source link

Uncaught exception 'RuntimeException' #279

Closed abr4xas closed 8 years ago

abr4xas commented 8 years ago

Hi there,

I'm testing pico Version 1.0.0-beta.1 and:

Fatal error: Uncaught exception 'RuntimeException' with message 'Required "404.md" not found' in /var/www/pico/lib/Pico.php:670 Stack trace: #0 /var/www/pico/lib/Pico.php(293): Pico->load404Content('/var/www/pico/c...') #1 /var/www/pico/index.php(17): Pico->run() #2 {main} thrown in /var/www/pico/lib/Pico.php on line 670

My config.php

/*
 * CONTENT
 */
 $config['date_format'] = '%D %T';            // Set the PHP date format as described here: http://php.net/manual/en/function.strftime.php
 $config['pages_order_by'] = 'alpha';         // Order pages by "alpha" or "date"
 $config['pages_order'] = 'asc';              // Order pages "asc" or "desc"
 $config['content_dir'] = 'content/';  // Content directory
 $config['content_ext'] = '.md';              // File extension of content files to serve
theshka commented 8 years ago

Do you have a file called 404.md in your content/ directory @abr4xas?

abr4xas commented 8 years ago

@theshka yes sir

theshka commented 8 years ago

I do not receive this error unless I delete my 404.md from the content-sample directory, so I'm not sure why if you have the file there that it would be throwing the exception.

Can you double-check these things:

abr4xas commented 8 years ago
---
Title: Error 404
Robots: noindex,nofollow
---

captura de pantalla 2015-11-18 a la s 20 43 40

PhrozenByte commented 8 years ago

Pico isn't able to find the content dir you specified. Is your config.php located in Picos root dir or in config/config.php?

abr4xas commented 8 years ago

@PhrozenByte in config/

PhrozenByte commented 8 years ago

Can you please give me the output of the page when adding

var_dump($this->config, file_exists($this->getConfig('content_dir') . '404.md')); die();

to a new line before line 354 of lib/Pico.php? Please don't forget to remove the line afterwards.

abr4xas commented 8 years ago

Output:

Warning: file_get_contents(/var/www/pico/content/404.md): failed to open stream: No such file or directory in /var/www/pico/lib/Pico.php on line 649

Warning: scandir(/var/www/pico/content): failed to open dir: No such file or directory in /var/www/pico/lib/Pico.php on line 1213

Warning: scandir(): (errno 2): No such file or directory in /var/www/pico/lib/Pico.php on line 1213

Sorry:

array(11) { ["site_title"]=> string(4) "Pico" ["base_url"]=> string(22) "http://tma.local/pico/" ["rewrite_url"]=> NULL ["theme"]=> string(7) "default" ["twig_config"]=> array(3) { ["cache"]=> bool(false) ["autoescape"]=> bool(false) ["debug"]=> bool(false) } ["date_format"]=> string(5) "%D %T" ["pages_order_by"]=> string(5) "alpha" ["pages_order"]=> string(3) "asc" ["content_dir"]=> string(22) "/var/www/pico/content/" ["content_ext"]=> string(3) ".md" ["timezone"]=> string(3) "UTC" } bool(false)
PhrozenByte commented 8 years ago

The content directory /var/www/pico/content/ doesn't exist. Please check your installation directory.

abr4xas commented 8 years ago

The content directory exist

captura de pantalla 2015-11-18 a la s 20 43 40

https://github.com/picocms/Pico/issues/279#issuecomment-157915148

PhrozenByte commented 8 years ago

PHP unmistakable states that the directory /var/www/pico/content/ either doesn't exist (scandir(/var/www/pico/content): failed to open dir: No such file or directory - i.e. your screenshot doesn't show /var/www/pico) or isn't visible to the PHP process.

This is a misconfiguration of your webserver. Please check your webserver configuration (this issue is completely independent of Pico) and make sure that the directory is accessible by your webserver/PHP process. Unfortunately the configuration of webservers is out of our scope. Sorry :disappointed:

abr4xas commented 8 years ago

thanks, folder permissions were changed.

dav-m85 commented 8 years ago

@theshka @PhrozenByte A goot point here, we maybe should dispatch a message when the permissions are wrong but the directory exists.

Want a PR on this ?

PhrozenByte commented 8 years ago

The problem weren't wrong permissions of the content dir, but of Pico's root dir - otherwise the message would have been Permission denied, not No such file or diectory.

dav-m85 commented 8 years ago

My bad. You're right.