BookStack: [Support Request]: Failed to use Export PDF
Attempted Debugging
- I have read the debugging page
Searched GitHub Issues
- I have searched GitHub for the issue.
Describe the Scenario
Hi,
I encounter a problem when I use export-books.php :
PHP Warning: file_get_contents(http://localhost/api/books?count=100&offset=0): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/userbookstack/export-books.php on line 72 PHP Fatal error: Uncaught TypeError: Return value of apiGetJson() must be of the type array, null returned in /home/userbookstack/export-books.php:81 Stack trace: #0 /home/userbookstack/export-books.php(48): apiGetJson('api/books?count...') #1 /home/userbookstack/export-books.php(20): getAllBooks() #2 {main} thrown in /home/userbookstack/export-books.php on line 81
First I have to explain my configuration, my bookstack is configured with SSL : https://bookstack.intra.local
This is the apache conf :
<VirtualHost *:443>
'ServerName bookstack.intra.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/bookstack/public/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/bookstack.intra.local cer
SSLCertificateKeyFile /etc/ssl/private/bookstack.intra.local.key
My API Jeton is ok and this is the export-books.php file :
$apiUrl = getenv('BS_URL') ?: 'http://localhost'; // http://bookstack.local/
$clientId = getenv('BS_TOKEN_ID') ?: 'ThisIsMySecret';'
$clientSecret = getenv('BS_TOKEN_SECRET') ?: 'ThisIsMySecret';
Exact BookStack Version
21.08.5
Log Content
No response
PHP Version
No response
Hosting Environment
Ubuntu 18.4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (8 by maintainers)
Hi Dan,
I finally found the php.ini few minutes before you wrote you message, and it works.
Thank you for taking time with me 😃 Have a nice day.
@Buliwif The
.inito edit can depend on the operating system, PHP version in use and how you’re actually running PHP. If you’re running from the command line, those changes probably won’t make a difference. Additionally, you’re editing files for php7.2, whereas BookStack requires php7.3 or greater. (Assuming you’re running the script on the same system as BookStack. If not, ignore this).If you’re running the scripts via command line, you can often find the right
php.inifile by running:In regards to the option of editing the script:
For this function: https://github.com/BookStackApp/api-scripts/blob/f165f615fae3b415cbf47a96661c4d43043e6a11/php-export-all-books/export-books.php#L64-L73
Disabling SSL verification would look like this instead: