BCcampus / pressbooks-openstax-import

[UNMAINTAINED] Pressbooks Plugin for OpenStax Textbook Import
GNU General Public License v3.0
5 stars 0 forks source link

HTTP error when importing #85

Closed allisonpbrown closed 5 years ago

allisonpbrown commented 5 years ago

When importing a CNX title, I’m getting an HTTP 500 error. We’ve updated our import settings and PHP upload settings, but even with single chapter zip files, the importer goes straight to an error screen (no loading/thinking time) on Chrome, and in Firefox I only see a white screen.

We’ve recently upgraded to the latest versions of both PB and the OpenStax plugin, so was wondering if this was a problem anyone else had experienced. (all current settings are listed below).

Other types of imports work as expected, and I’ve tried multiple OS titles and files on two different PB book sites and got the same error, both using the upload file option, and the Import from URL option. I don’t have access to another version of PB with this plugin installed to see if it is localized to our instance.

screen shot 2019-01-24 at 4 08 45 pm screen shot 2019-01-24 at 4 08 20 pm

System Information WordPress Configuration Network Type: Subdirectory Version: 5.0.3 Language: en_US WP_ENV: Not set WP_DEBUG: Enabled Memory Limit: 64M

Pressbooks Configuration Version: 5.6.4 Root Theme: Aldine Root Theme Version: 1.5.0

Pressbooks Dependencies Epubcheck: Installed Kindlegen: Installed xmllint: Installed PrinceXML: Installed Saxon-HE: Installed

Must-Use Plugins Global SMTP: 1.0 hm-autoloader.php: n/a WP Multisite Allow Hyphens and Underscores Override Admin: 1.0 WP Pressbooks Allow Prince 300dpi Images: n/a

Network Active Plugins Candela Citation: 0.2.2 Check Email: 0.5.5 Disable Comments: 1.8.0 Error Log Monitor: 1.6.3 GitHub Updater: 8.6.2 Hypothesis: 0.5.0 iframe: 4.4 Members: 2.1.0 Openstax Import for Pressbooks: 1.3.2 Pressbooks: 5.6.4 Textbooks for Pressbooks: 4.2.3 UpdraftPlus - Backup/Restore: 2.16.4.24 WordPress Mass Email to users: 1.0 WP-Optimize: 2.2.11 WP QuickLaTeX: 3.8.6

Root Blog Active Plugins Openstax Import for Pressbooks:

Version: 1.3.2 Author: Brad Payne Last Updated: 3 weeks ago Requires WordPress Version: 4.9.8 or higher Compatible up to: 5.0.3 Requires PHP Version: 7.1 or higher Active Installations: Less Than 10 Candela Citation: 0.2.2 Check Email: 0.5.5 Disable Comments: 1.8.0 Error Log Monitor: 1.6.3 GitHub Updater: 8.6.2 Hypothesis: 0.5.0 iframe: 4.4 Members: 2.1.0 Pressbooks: 5.6.4 Textbooks for Pressbooks: 4.2.3 UpdraftPlus - Backup/Restore: 2.16.4.24 WordPress Mass Email to users: 1.0 WP-Optimize: 2.2.11 WP QuickLaTeX: 3.8.6

Inactive Plugins Better Search Replace: 1.3.2 Broken Link Checker: 1.11.5 Edit Flow: 0.9 MemcacheD Is Your Friend: 2.0.0 WP-Piwik: 1.0.19

Server Configuration PHP Version: 7.3.1 MySQL Version: 5.6.42 Webserver Info: Apache/2.4.6 () OpenSSL/1.0.2k-fips PHP/7.3.1

PHP Configuration Safe Mode: Disabled Memory Limit: 256M Upload Max Size: 2000M Post Max Size: 3000M Upload Max Filesize: 2000M Time Limit: 5000 Max Input Vars: 1000 URL-aware fopen: On (1) Display Errors: N/A

PHP Extensions OPcache: Zend XDebug: Disabled cURL: Supported cURL Version: 7.29.0 imagick: Not Installed xsl: Installed

josieg commented 5 years ago

Hi Allison,

What textbook are you trying to import?

Can you try again using the following process:

  1. Go to OpenStax site and find the book you want to import. Click "View Online" and scroll to the bottom of the page where they have additional files listed.
  2. Find the "Offline Zip" file, right-click it, and select "Copy link address." It should look somthing like this: https://cnx.org/exports/14fb4ad7-39a1-4eee-ab6e-3ef2482e3e22@12.7.zip/anatomy-and-physiology-12.7.zip
  3. Open Pressbooks and the book you'd like to import to.
  4. On the Import page, select "cnx.org" as the Import Type.
  5. Select "Import from URL" as the Import Source.
  6. Paste the link to the Offline Zip file (shown in step 2) in the textbox provided.
  7. Click "Begin Import."
  8. Select all chapters you want to import and confirm the import. (If it is a large book, try doing just a few at a time or the process may time out.)
allisonpbrown commented 5 years ago

Hi @josieg. Thanks for your note. The text we are trying to import is Essentials of Precalc https://cnx.org/contents/l3_8ZlRi@1.94:s_RCPZWY@20/Preface, or the full Precalc. I've tried uploading the zip file (both full text and single chapter) but I get the same error.

josieg commented 5 years ago

Hi @allisonpbrown,

I was able to import this book successfully. I think you are either using the wrong process or this a problem on your end. When importing by URL, make sure you are using the URL for the Offline Zip file, not the webpage URL.

I've have a Pressbooks XML file for this book that you can use to import it into your Pressbooks account. Github won't let me upload it here, but if you email me at jgray@bccampus.ca I will send it to you.

bdolor commented 5 years ago

@allisonpbrown @rootl the error message from the log files would confirm the source of the problem. If the application is responsible for triggering a 500 I would be interested in knowing what that is, however, I can't reproduce the issue on my end.

allisonpbrown commented 5 years ago

Hi @bdolor, Leah posted the log files at the PB ticket post: https://pressbooks.community/t/cnx-import-leading-to-http-error/864/4

rootl commented 5 years ago

[Fri Jan 25 12:04:31.721184 2019] [php7:warn] [pid 2045] [client 74.102.17.203:6835] PHP Warning: Use of undefined constant \xe2\x80\x98WP_DEBUG_LOG\xe2\x80\x99 - assumed ‘\xe2\x80\x98WP_DEBUG_LOG\xe2\x80\x99’ (this will throw an Err$ [Fri Jan 25 12:04:32.508872 2019] [core:error] [pid 1912] [client 74.102.17.203:6836] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit$

rootl commented 5 years ago

@bdolor cc @allisonpbrown

NOTES:

I turned off wp_debug_log in wp-config so that gets rid of one error.

I am able to successfully upload media files and plugins through the admin area without redirect errors or 'white screen of death.' .

I turned off the OpenStax Import plugin, tried to import a docx and an epub; received that "Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit$"

bdolor commented 5 years ago

Thanks Leah, but I don't see the 500 error in the log file dump? (if you're still getting redirect errors with the pressbooks-openstax-import plugin deactivated, it is something separate and unrelated to what I might be able to help you with here)

bdolor commented 5 years ago

What we are looking for is a more robust explanation around the 500 error which I can get from both apache log files and the debug.log file in WP (if I have debugging enabled). If it's still the 500 error that we're chasing and depending on your server/config the following steps will vary slightly:

the resulting dump will tell me where the source of the failure is, for instance:

image

Though this 500 error is unrelated to the one reported here, if I were to start troubleshooting it, I would know what and where it failed which gives me a place to start looking in the code. If you have a similar dump, and the what and where points to something in the plugin I might be able to help.

rootl commented 5 years ago

Greetings: no 500 errors were present in either the error or access logs. I am talking to the CIT folks who host our vm. I test imported a docx file via Import, failed as before, and these are results from access and error logs (408 timeout, 403 permissions, and what looks like htaccess or httpd config problems):

This is from var/log/httpd/ssl_access_log: 137.238.43.133 - - [28/Jan/2019:08:28:08 -0500] "-" 408 - 137.238.43.133 - - [28/Jan/2019:08:28:08 -0500] "-" 408 - 137.238.43.133 - - [28/Jan/2019:08:28:09 -0500] "-" 408 - 137.238.1.104 - - [28/Jan/2019:08:28:45 -0500] "GET / HTTP/1.0" 403 3539 137.238.1.104 - - [28/Jan/2019:08:29:45 -0500] "GET / HTTP/1.0" 403 3539 137.238.1.104 - - [28/Jan/2019:08:30:45 -0500] "GET / HTTP/1.0" 403 3539 142.12.127.94 - - [28/Jan/2019:08:31:05 -0500] "-" 408 - 137.238.1.104 - - [28/Jan/2019:08:31:45 -0500] "GET / HTTP/1.0" 403 3539 137.238.1.104 - - [28/Jan/2019:08:32:45 -0500] "GET / HTTP/1.0" 403 3539 137.238.1.104 - - [28/Jan/2019:08:33:45 -0500] "GET / HTTP/1.0" 403 3539 137.238.1.104 - - [28/Jan/2019:08:34:31 -0500] "GET / HTTP/1.1" 403 3539 137.238.1.104 - - [28/Jan/2019:08:34:45 -0500] "GET / HTTP/1.0" 403 3539 76.76.162.17 - - [28/Jan/2019:08:35:38 -0500] "-" 408 - 137.238.1.104 - - [28/Jan/2019:08:35:45 -0500] "GET / HTTP/1.0" 403 3539

from var/log/httpd/ssl_error_log:

[Mon Jan 28 08:30:45.762845 2019] [autoindex:error] [pid 27486] [client 137.238.1.104:50435] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive [Mon Jan 28 08:31:45.760941 2019] [autoindex:error] [pid 27540] [client 137.238.1.104:50773] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive [Mon Jan 28 08:32:45.763753 2019] [autoindex:error] [pid 27516] [client 137.238.1.104:51210] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive [Mon Jan 28 08:33:45.765589 2019] [autoindex:error] [pid 27486] [client 137.238.1.104:51580] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive [Mon Jan 28 08:34:31.083521 2019] [autoindex:error] [pid 27643] [client 137.238.1.104:51833] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive

bdolor commented 5 years ago

Looks to me like this is server related and if it's failing on DOCX import, then unrelated to pressbooks-openstax-import. If you discover anything specific to this plugin, please feel free to re-open.

rootl commented 5 years ago

Extra HTTPS directive in htaccess. Deleted/replaced htaccess .
Now able to import DOCX and WXR files.

However, Still unable to import OpenStax file. PHP error below:

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/html/milnepublishing.geneseo.edu/wp-content/plugins/pressbooks-openstax-import/inc/import/openstax/class-cnx.php:54 Stack trace: #0 /var/www/html/milnepublishing.geneseo.edu/wp-content/plugins/pressbooks-openstax-import/pressbooks-openstax-import.php(111): BCcampus\Import\OpenStax\Cnx->__construct() #1 /var/www/html/milnepublishing.geneseo.edu/wp-includes/class-wp-hook.php(286): {closure}(Array) #2 /var/www/html/milnepublishing.geneseo.edu/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #3 /var/www/html/milnepublishing.geneseo.edu/wp-content/plugins/pressbooks/inc/modules/import/class-import.php(458): apply_filters('pb_initialize_i...', Array) #4 /var/www/html/milnepublishing.geneseo.edu/wp-content/plugins/pressbooks/inc/modules/import/class-import.php(262): Pressbooks\Modules\Import\Import::setImportOptions() #5 /var/www/html/milnepublishing.geneseo.edu/wp-includes/class-wp-hook.php(286): Pressbooks\Modules\Import\Import::formSubmit(' in /var/www/html/milnepublishing.geneseo.edu/wp-content/plugins/pressbooks-openstax-import/inc/import/openstax/class-cnx.php on line 54