Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
600 views
in Technique[技术] by (71.8m points)

php - Fatal error: Uncaught Error: Call to undefined function PDFNet_Initialize

I am trying to run PDFTron for php following the instructions. However, when called: PDFNet::Initialize(); i'm getting an error

Fatal error: Uncaught Error: Call to undefined function PDFNet_Initialize() in .../PDFNetPHP_core.php

I assume that PDFNet_Initialize is part of extension because i can't see declaration in PDFNetPHP_core.php file

I setup exenstion PDFNetPHP.so and enable_dl = on in php.ini. Also when i run test in PDFNetWrappers/Samples/AddImageTest/PHP then it's looks ok:

PDFNet is running in demo mode.
Permission: write
Done. Result saved in addimage.pdf...<br />

when i run php -m module PDFNetPHP is on list

what am I doing wrong?

question from:https://stackoverflow.com/questions/65936086/fatal-error-uncaught-error-call-to-undefined-function-pdfnet-initialize

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If the sample code is working on your end, it's likely that your project is unable to find the libPDFNetC.soshared library. The RunTest.sh in the AddImageTest sample sets the following environment variable:

export LD_LIBRARY_PATH=../../../PDFNetC/Lib

You might need to add the .so explicitly, or at least put the .so in a folder that PHP will load .so files from. See your PHP documentation. Please also see the following post: https://stackoverflow.com/a/35442777/3761687


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...