{"id":2182,"date":"2017-10-16T15:49:57","date_gmt":"2017-10-16T10:19:57","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2182"},"modified":"2026-09-15T19:04:15","modified_gmt":"2026-09-15T13:34:15","slug":"pdflib-support-php7-0-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/pdflib-support-php7-0-ubuntu-16-04\/","title":{"rendered":"Installing and Configuring PDFlib with PHP 7.0 on Ubuntu 16.04"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to enable PDFlib support for PHP on Ubuntu, so PHP applications can generate PDFs using the PDFlib library.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One note upfront: the original version of this guide targeted PHP 7.0 and Ubuntu 16.04, both long past end-of-life. The steps below follow the same process but generalized to your actual current PHP version and Ubuntu release \u2014 check <a href=\"https:\/\/www.pdflib.com\/download\/pdflib-family\/pdflib\/\" target=\"_blank\" rel=\"noopener\">PDFlib&#8217;s download page<\/a> for the current PDFlib version and matching PHP binding, since hardcoding an old version number (as the original did) can point you to a build that no longer matches your current PHP.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">I. Prerequisites<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu (or another Linux distribution) with Apache and PHP installed<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>Knowledge of your server&#8217;s architecture and PHP version<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">II. How PDFlib Fits Into PHP<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PDFlib ships as a <strong>PHP extension<\/strong> (<code>.so<\/code> file), specific to your PHP version and architecture<\/li>\n\n\n\n<li>PHP loads it at startup based on your <code>php.ini<\/code> configuration<\/li>\n\n\n\n<li>Once loaded, your PHP scripts can call PDFlib&#8217;s functions directly to generate PDFs<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-scaled.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"452\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-1024x452.png\" alt=\"\" class=\"wp-image-11793\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-1024x452.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-300x132.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-768x339.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-1536x678.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib_php_architecture-2048x904.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">III. Download PDFlib<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check your server&#8217;s architecture, then download the matching PDFlib package from the <a href=\"https:\/\/www.pdflib.com\/download\/pdflib-family\/pdflib\/\" target=\"_blank\" rel=\"noopener\">official PDFlib site<\/a> \u2014 the exact filename will include the current version number, which changes over time:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/usr\/local\/src\nwget https:\/\/www.pdflib.com\/binaries\/PDFlib\/&lt;VERSION>\/PDFlib-&lt;VERSION>-Linux-x86_64-php.tar.gz\ntar -xvf PDFlib-&lt;VERSION>-Linux-x86_64-php.tar.gz\ncd PDFlib-&lt;VERSION>-Linux-x86_64-php\/\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Replace <code>&lt;VERSION&gt;<\/code> with the actual current version shown on PDFlib&#8217;s download page \u2014 don&#8217;t reuse an old version number from an outdated guide, since it may no longer be available or compatible with your PHP version.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">IV. Find Your PHP Extension Directory<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php -i | grep extension_dir\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original command was <code>php -ini<\/code>, which isn&#8217;t a valid PHP flag. The correct flag is <code>-i<\/code> (info), as shown above.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This shows a path like <code>\/usr\/lib\/php\/20220829<\/code> \u2014 the exact directory number is specific to your PHP version&#8217;s ABI.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">V. Copy the Extension File<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the extracted PDFlib folder, find the <code>.so<\/code> file matching your PHP version (for example, <code>bind\/php\/php-82\/php_pdflib.so<\/code> for PHP 8.2), then copy it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cp bind\/php\/php-&lt;YOUR_PHP_VERSION>\/php_pdflib.so \/usr\/lib\/php\/&lt;YOUR_EXTENSION_DIR>\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">VI. Add the Extension to php.ini<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi \/etc\/php\/&lt;YOUR_PHP_VERSION>\/apache2\/php.ini\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">extension=php_pdflib.so\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">VII. Verify Apache Configuration and Restart<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apachectl -t\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If it returns <code>Syntax OK<\/code>, restart Apache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl restart apache2\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The original guide used <code>\/etc\/init.d\/apache2 graceful<\/code>, which still works on many systems, but <code>systemctl restart apache2<\/code> is the current standard approach on systemd-based distributions.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">VIII. Verify<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a <code>phpinfo()<\/code> test file and load it in your browser to confirm the PDFlib section appears.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib-300x48-1.png\"><img decoding=\"async\" width=\"300\" height=\"48\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/pdflib-300x48-1.png\" alt=\"\" class=\"wp-image-11791\"\/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">IX. Conclusion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Enabling PDFlib for PHP comes down to matching the extension file to your exact PHP version and extension directory, then registering it in <code>php.ini<\/code>. Always check PDFlib&#8217;s current download page rather than reusing an old version number, and use <code>php -i<\/code> (not <code>-ini<\/code>) when locating your extension directory.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why doesn&#8217;t PDFlib show up in phpinfo after restarting?<\/strong> Usually a mismatched PHP version between the <code>.so<\/code> file and your actual PHP installation, or an incorrect <code>extension_dir<\/code> path \u2014 double-check both against your <code>php -i<\/code> output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Is PDFlib free to use?<\/strong> PDFlib offers both a free trial\/lite version and paid licensed versions with additional features \u2014 check their site for current licensing details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do I need to rebuild the extension for each PHP update?<\/strong> Yes \u2014 since the <code>.so<\/code> file is tied to a specific PHP ABI version, updating PHP typically requires downloading and installing the matching PDFlib build again.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-install-avideo-youphptube-on-ubuntu-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install AVideo\/YouPHPTube on Ubuntu Server<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\">Using PHP and Cron to Automate Kannel Status Monitoring<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team <a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This guide explains how to enable PDFlib support for PHP on Ubuntu, so PHP applications can generate PDFs using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-2182","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-zc","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2182"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2182\/revisions"}],"predecessor-version":[{"id":11794,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2182\/revisions\/11794"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}