Open tom-honeymoon-production opened 8 months ago
Thanks for the details.
The file is simply too lengthy for your local server to process. Consider using the media service feature instead.
Hi Ernesto, I have used the media service feature - please refer to attached screen shot. When I delete and add the PDF again - the same error is shown after 30 seconds. When I rebuild the search index with acrtivated media service feature (free license) after some seconds I get the success message but with 0 keywords added to the search index. And the counter for number of indexed files in the current period remains unchanged to 37/10000. Do you have any ideas what I could have configured in the wrong way? Kind regards Thomas
0 new keywords can be just an missing count from the query report, the keywords are very likely still there. I checked the remote server, the document was parsed correctly and it's there. The counter may not move as it was probably cached from me trying to index it earlier and it did not count towards your usage.
My only guess here is a possible firewall, not allowing the connection, so make sure that these domains and IP are not blocked.
mediaservices.ajaxsearchpro.com
207.154.228.114
Also, the file has a lot of text, over 300 pages as far as I can see, so make sure your PHP memory limit is plenty large in php.ini, I recommend at least 512MB:
; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 512M
Increase the max execution time as well temporarily, I can see this time out on the server side:
; Maximum execution time of each script, in seconds
; https://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 120
On my end it's working fine on both a remote and local server, I see the parsed text as well on the media file window when I upload the file.
Hi Ernesto, thanks for your very fast response. I also see content parsed by Ajax Search Pro Media Service. But searching for special word in that content the search result doesn't include that document. How can I check the index to verify the words are included in the index? Many thanks in advance Thomas
If you don'tr get any results for anything in the file content, then it's not indexed for sure.
That means that the indexing process fails. That could be just a simple server or process performance issue, it is quite a lengthy file, I can imagine the PHP process failing if the server can't handle it. The error message confirms that as well.
I suggest the PHP ini changes I mentioned above, longer time and a bit more memory will very likely do the trick.
Hi Ernesto, I changed the server limits PHP memory limit was already 1024M - but I changed 'max_execution_time' from 30 to 240. The File gets uploaded and the content as parsed by the AJAX media service is available. After about 1 Minute I get an 500 server error. When I checked the search - I don't get a result. See attached infos. Kind regards Thomas
Okay, at least there is an error message, which leads somewhere.
Error 500 means an internal server error, which will write a log and will lead to the solution here. Can you please check the PHP error log?
Usually the easiest way to find the related error in the PHP error log is to replicate the issue, then check the log immediately. You can upload it as well after triggering the error, I can probably find it.
hmmm, I didn't get an error logged to the WordPress error log file. I even inserted a plugin to generate some fatal errors and warnings to see if I have configured error log handling correctly. Then I deactivated that 'plugin' again and loaded the big file again. I get an 500 error but no entry in the wordpress error log file
Check if the error logging is enabled, error 500 will trigger a log, as it's due to a fatal error.
Check the php.ini configuration for the log file location. Usually it's in /var/log foldel on the server.
There is no path in the php.ini but only the ERROR_LOG WordPress constants defined in wp_config. The Error File is located in /wp-content/debug.log
Well, that error seems to be unrelated, as far as I can tell.
Unless the log file can be found somewhere, I can't do much. You may have to consult with the host to see where PHP is actually logging (not by WP configuration), and if the error reporting is enabled with that configuration. It differs for every system, but that is out of the scope of this issue.
I'm a little bit frustrated - I asked my webhoster and added the error log configuration to the php.ini. When I create a 500 Server error with another plugin - the 500 error is logged but not when I upload that file.
Try a different error log location, that is the same as it's defined in the wordpress config, so you can't be sure if it's coming from the PHP ini or the config. Note that there are multiple php.ini-s on most servers, one for the CLI and one for the Apache or FPM handler. I suggest only adding the definie('WP_DEBUG', true);
to the wp-config.php and nothing else related to logging, so they don't conflict and it uses the default PHP log file. The direct the error log somewhere else in the php.ini to make sure it's actually working.
Either way, this is now not plugin related, but I will still try to help if I can. If there is an error 500 reported, that is triggered by a fatal error in the PHP and it has to exist or logged somewhere. PHP fatal errors don't just vanish.
Many thanks for your patience!!!
" I suggest only adding the definie('WP_DEBUG', true); to the wp-config.php and nothing else related to logging, so they don't conflict and it uses the default PHP log file. The direct the error log somewhere else in the php.ini to make sure it's actually working."
I have done this ;-) Same result :-(
What I'm wondering: the max_execution_time is set to 240 seconds but the 500 error occurs after about 1 minute.
Well, only thing left is then to direct the error log to a different file in the php.ini to see if that actually directs the log there. Also, might be worth checking the Apache access logs to see if there is something valuable. I honestly don't know what is wrong here.
Describe the bug
I created an search index including PDF content to be indexed and a search instance.
Then I added a PDF file to the WordPress Media Library (s. attachment, 4MB) and after 30 seconds I get this error message: "PHP Fatal error: Maximum execution time of 30 seconds exceeded in [...]/wp-content/plugins/ajax-search-pro/includes/classes/Index/Tokenizer.php on line 248"
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The PDF content shall be indexed or if maximum execution time is exceeded a fatal error shall be avoided
Screenshots
n/a
Environment checklist
Desktop (please complete the following information):
Smartphone (please complete the following information):
n/a
Additional context
n/a TestTomHaushalt2023.pdf