Forum
Editor goes blank after entry, and preview gives 404 error
Perch: 2.8.31, PHP: 5.4.43, MySQL: 5.5.42-37.1, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31)
App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /home5/newcity4/public_html/perch
PERCH_CORE: /home5/newcity4/public_html/perch/core
PERCH_RESFILEPATH: /home5/newcity4/public_html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 64M, Max POST 64M, Memory: 256M, Total max file upload: 64M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
DOCUMENT_ROOT: /home5/newcity4/public_html
HTTP_HOST: www.newcitychiropractic.com
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
After saving an entry in new region/new page, editor goes blank and preview gives 404 error. Diagnostics say runtime path is 'core/apps/content/runtime.php' rather than 'perch/runtime.php' as on old pages. Using that extended perch path gave same error. Entries are always saved as draft.
Problem discovered adding template type='youtube' on a new page under v 2.8.26. Then upgraded to 2.8.31 and problem persists, and now for any field-type on any new page.
Error log shows: [15-Aug-2016 08:03:34] PHP Notice: Use of undefined constant DIR - assumed 'DIR' in /home5/newcity4/public_html/perch/core/index.php on line 4 [15-Aug-2016 08:03:34] PHP Warning: include(DIR/inc/pre_config.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home5/newcity4/public_html/perch/core/index.php on line 4 [15-Aug-2016 08:03:34] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'DIR/inc/pre_config.php' for inclusion (include_path='.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear') in /home5/newcity4/public_html/perch/core/index.php on line 4 [15-Aug-2016 08:03:34] PHP Notice: Use of undefined constant DIR - assumed 'DIR' in /home5/newcity4/public_html/perch/core/index.php on line 5
<perch:content id="addvideo" type="youtube" width="420" label="YouTube URL" output="embed" />
config/config.php updated with Google API and field-type file youtube copied in.
Was missing templates/pages/attributes/default.html.
If you're getting an error about
__DIR__
being undefined, then that's probably a hosting error we can't help you recover from.__DIR__
is a core part of the language since PHP 5.3, so if your PHP 5.4 installation doesn't have it I don't have a solution for you. You should speak to your host.I upgraded to PHP v5.6 and no longer get a php error or warning. However, the symptoms remain when I enter a You Tube url in perch admin; namely that on clicking save the screen goes blank and the YouTube video is not embedded.
For older perch regions, I am now also getting a blank page after saving, but the entry (in a textblock) is successfully added to the page. For both an old textblock region and the new YouTube region, View Page gives me a 404 error. For the textblock, it's at https://www.newcitychiropractic.com/perch/core/apps/content/edit/www.newcitychiropractic.com/resources.php (which I suppose is the draft page address), rather than the actual page's URL.
Seems like a configuration error that I can't figure out, but also the YouTube embed fails, whereas the textblock succeeds. And View Page from admin fails in both cases.
If you are getting a blank page then you have a PHP error, so we need to know what that is.
https://docs.grabaperch.com/perch/building/troubleshooting/why-am-i-getting-a-blank-page/
Here are the entries in the php error log:
[06-Sep-2016 15:51:32 UTC] PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /home5/newcity4/public_html/perch/addons/fieldtypes/youtube/youtube.class.php on line 180 [06-Sep-2016 15:51:32 UTC] PHP Warning: simplexml_load_string(): No longer available in /home5/newcity4/public_html/perch/addons/fieldtypes/youtube/youtube.class.php on line 180 [06-Sep-2016 15:51:32 UTC] PHP Warning: simplexml_load_string(): ^ in /home5/newcity4/public_html/perch/addons/fieldtypes/youtube/youtube.class.php on line 180 [06-Sep-2016 15:51:32 UTC] PHP Fatal error: Call to a member function xpath() on boolean in /home5/newcity4/public_html/perch/addons/fieldtypes/youtube/youtube.class.php on line 182
youtube.class.php:
That sounds very much like you're getting an odd response back from YouTube. Do you have debug turned on?
Debug message on entry to admin: SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='097a52f08154be502e8b329a5f5fd23d' LIMIT 1 UPDATE perch2_users SET userHash='b5e3e19f462866a397f0f9fdf938a41f' WHERE userID='1' [29] SELECT p.privKey FROM perch2_user_privileges p [18] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID [1] SELECT * FROM perch2_content_regions WHERE regionID=18 LIMIT 1 [1] SELECT * FROM perch2_pages WHERE pageID='11' LIMIT 1 [1] SELECT * FROM perch2_content_items WHERE regionID=18 AND itemRev=7 ORDER BY itemOrder ASC [1] SELECT * FROM perch2_content_items WHERE regionID=18 AND itemRev=7 ORDER BY itemOrder ASC Using template: /templates/content/video.html Form not posted or did not validate Setting alert: You are editing a draft. Preview (draft)
So I take it that Perch is not happy with the template. The template is as follows:
After entry of the YouTube URL and save, the page goes blank so there are no debug messages.
What's the URL of the video you're trying?
Doesn't seem to matter which URL: https://www.youtube.com/watch?v=y60wDzZt8yg
Does it work in your dev environment?
I am working on a webhosting server -- I copied an html page, put a php extension on it, included perch/runtime and added a perch region to it. Once it's working, I'll replace the html page with the php page in the navigation.
Ok, so no dev environment at all?