Forum

Thread tagged as: Error, Configuration

Moving resources out from Perch folder causes 'Resources folder is not writable'

Ran into this problem that I have not had before. I like to keep resources out of the perch folder (which I rename for a little more security) and in my /assets/ folder along with css fonts and other gubbings. To do this I change the Config fields:

define('PERCH_RESFILEPATH', '‎path/on/my/mac/to/my/project/folder/assets⁩/resources');
define('PERCH_RESPATH', '/assets/resources');

On the current project I am building (first one for a lot of months) the resources folder was fine until I changed it's location in config. Yes I changed the new folders permissions (even to 777).

So I span up a new instance of Perch in MAMP Pro, added a fresh dbase and installed Perch 3.1.3 - everything was fine. Changed config to a new resources folder in an assets folder and bang - same issue 'Resources folder is not writable'. I then opened up some old Perch projects that had worked with resources in /assets/ and they now also show 'Resources folder is not writable'. There is nothing in the php log in MAMP to suggest an issue. So I am thinking could this be an OSX 10.4 Mojave issue as I know they have locked things down a lot?

Perch LTM: 3.1.3
Production mode: Production (100)
Installed apps: content (3.1.3), assets (3.1.3), categories (3.1.3)
DB driver: PDO
DB tables: perch3_categories (0), perch3_category_counts (0), perch3_category_sets (0), perch3_content_index (0), perch3_content_items (0), perch3_content_regions (0), perch3_jaygeorge_perch_admin_style_settings (0), perch3_menu_items (9), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (0), perch3_pages (0), perch3_resource_log (0), perch3_resource_tags (0), perch3_resources (0), perch3_resources_to_tags (0), perch3_settings (11), perch3_user_passwords (0), perch3_user_privileges (30), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = [ 
    ];
Editor plug-ins:
H1: 7d3a061a6a8e98a2e709047d15d1adaf
L1: 7b7ccf6708d9f632ef2f94901748e74b
F1: 3b606135b33e6a102526838f4152a807
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.1.3
update_3.1.3: done
latest_version:
on_sale_version: 3.1.3
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: host13
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: host13
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: host13@simoncox.com
PERCH_EMAIL_FROM_NAME: host13 host13
PERCH_LOGINPATH: /cms
PERCH_PATH: /Users/simoncox/Desktop/testsite/cms
PERCH_CORE: /Users/simoncox/Desktop/testsite/cms/core
PERCH_RESFILEPATH: ‎⁨iCloud Drive⁩/Desktop⁩/testsite⁩/assets⁩/resources
PERCH_RESPATH: /assets/resources
PERCH_HTML5: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 6738d5d5f5664f7c5e34
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/simoncox/Desktop/testsite/cms/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.1.20
Zend: 3.1.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
MySQL server: 5.7.23
Free disk space: 13.14 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysqli, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, pgsql, pdo_pgsql, imagick
GD: Yes
ImageMagick: Yes
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: No
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x2
ORIG_SCRIPT_NAME: /fcgi-bin/php7.1.20.fcgi
ORIG_PATH_TRANSLATED: /Users/simoncox/Desktop/testsite/cms/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /cms/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php7.1.20.fcgi
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /cms/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 59294
SCRIPT_FILENAME: /Users/simoncox/Desktop/testsite/cms/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Users/simoncox/Desktop/testsite
REMOTE_ADDR: ::1
SERVER_PORT: 80
SERVER_ADDR: ::1
SERVER_NAME: host-13.local
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_COOKIE: cmsa=1; PHPSESSID=c430ea65f342be3b96a5506a56bb8c45
HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.9,es;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_REFERER: https://host-13.local/cms/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_SEC_METADATA: cause="user-activated", destination="document", site="same-origin"
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: keep-alive
HTTP_HOST: host-13.local
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
FCGI_ROLE: RESPONDER
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1542021872.71
REQUEST_TIME: 1542021872
argc: 1
Simon Cox

Simon Cox 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

This needs to be a root-relative file system path:

define('PERCH_RESFILEPATH', '‎path/on/my/mac/to/my/project/folder/assets⁩/resources');

so it would be:

define('PERCH_RESFILEPATH', '‎/path/on/my/mac/to/my/project/folder/assets⁩/resources');

Also, 0777 is often configured to be blocked due to being dangerously permissive, so it can be a red herring to test with it.

Thanks Drew. That path was obscuring my actual project path.

In the test install I have spun up I have the root paths the same as the CMS path

PERCH_CORE: /Users/simoncox/Desktop/testsite/cms/core
PERCH_RESFILEPATH: ‎⁨/Users/simoncox/Desktop/testsite/assets⁩/resources

Still get Resources folder is not writable

Perch: 3.1.3, PHP: 7.1.20, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.1.3), assets (3.1.3), categories (3.1.3)
App runtimes: <?php $apps_list = [ ];
PERCH_LOGINPATH: /cms
PERCH_PATH: /Users/simoncox/Desktop/testsite/cms
PERCH_CORE: /Users/simoncox/Desktop/testsite/cms/core
PERCH_RESFILEPATH: ‎⁨/Users/simoncox/Desktop/testsite/assets⁩/resources
Image manipulation: GD Imagick
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: No
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/simoncox/Desktop/testsite
HTTP_HOST: host-13.local

And the /assets/resources folder has the same permissions as the /cms/resources folder

permissions

Drew McLellan

Drew McLellan 2638 points
Perch Support

All Perch is doing is this:

is_writable(PERCH_RESFILEPATH)

PHP is reporting that the path isn't writable, which is lower level than anything we're doing inside Perch.

OK thanks Drew. If i find a solution will post it here in case anyone has any a similar issue.

Solved it - with some trouble shooting from Ryan Gittings. To find the full path I was using MacOSX file info and copying the path from in there - after all who wants to hand type a full path out and make a typo (only people who want to build their own CMS from scratch...). Part of that path had space▸space which I replaced in text edit with a / to give me the path. However when I hand typed the full path everything worked perfectly. So it appears there might be extra invisible control characters in the path.

Hopefully that will help anyone else with the same issue - hand made is best.