Linking phpcpp fails when building PHP extension - php

Environment:
I am trying to develop a PHP-CPP extension and have downloaded the the empty extension file from https://www.php-cpp.com/documentation/your-first-extension to start. I have also modified the makefile's INI_DIR variable to point to the correct path.
Problem:
When I try to make the empty extension it fails to create the shared library file and says /usr/bin/ld: cannot find -lphpcpp.
I'm pretty sure I have php-cpp downloaded correctly, so I have no idea what's wrong. (I have also searched the internet and have found no solutions)
PHP version: 7.4
System: Elementary-OS (Ubuntu)

Turns out that when I first ran make to compile php-cpp it didn't make the libphpcpp.so file. So, I reinstalled it from Github and built it again and it worked. I don't know why I didn't try that the first time.

Related

Unable to load dynamic library 'php_grpc.dll'

My goal is to connect my laravel project to firestore firebase. I will be needing the grpc in order to continue it. However my problem is the .dll cant be found. I already uploaded the .dll file in ext folder.
I also included it in my php.ini file.
still getting the same error
I dont know if its the version og php and grpc is conflicting.
After applying the comments' suggestions:
You need to mention extensions without php_ and .dll prefix and suffix like below:
extension=fileinfo
extension=grpc
Restart Apache server if required. You can also check for php version on the command line using php --version. If it shows the version without any warnings/errors, it means the extensions are loaded correctly.
Also, as the error message in your screenshot suggests, you need to install the right thread safe package of GRPC relevant to your operating system architecture and PHP version from https://pecl.php.net/package/grpc
Since nice_dev pointed out it was a compatibilit issue. I downloaded the non thread x64 and used it. It worked. Been using the x84, maybe the reason why it's not working.

Cannot load imagick library

I have installed the imagick from here (ImageMagick-7.0.3-1-Q16-x64-dll) and the dll (TS 32 bit) from here. And also copiend the CORE_RL_* to the C:\xampp\apache\bin BUT still i get the following error when i run the laravel server.
ERROR: Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
Also, I placed dll file in C:\xampp\php\ext\php_imagick.dll.
Also, the imagick is shown in the phpinfo().
And when i use it using laravel i get the following error.
getting Imagick to work on Windows has always been a bit hit and miss as pointed out here is a good guide
http://stackoverflow.com/a/36378764/1090867
But it misses an important point
You do not need to put the binary into the PHP folder!
So here are the steps I follow myself every time I need to do this. This should work for apache, Nginx, or IIS.
Step 1
find out your php version and setting
You need to version, Architecture, Compiler and Thread Safety
if Thread Safety is disabled this is NTS is enabled it will TS
Step 2
Get and install a copy of ImageMagick and make sure it matches your Architecture, this also needs to be dll.exe rather than the static version.
Regarding Q8 and Q16 I'll leave that to you but both versions will work
Link
I recommend changing the install directory name to something generic like
C:\Imagemagick since I've had some problems in the past with the default directory name with PHP and windows.
Just install but make sure you tick add application path and I normally tick the legacy utils as well.
Once it's installed go to your environment variables and make sure it is actually in the path. There is no need to copy anything to your PHP folder
Just to make sure everything is working open the command line and type convert --version you should get a response
Step 3
This unfortunately is the hard part and can be a bit of trial and error. I've found the following provides the best php_imagick.dll that seems to work 9 times out of 10
http://www.peewit.fr/imagick/
Just pick the version that matches your install.
If this doesn't work then go to php.net and try each version until one works... (start at the latest)
http://windows.php.net/downloads/pecl/releases/imagick/
Once you have a php_imagick.dll put it into your php/ext/ folder
thne locate your php.ini file go to the bottom (or whereever your extensions are) and add extension=php_imagick.dll
Step 4
Restart PHP (or your computer) and it should be working if not try a different php_imagick.dll and repeat.
If the above doesn't work
Then try a slightly older version of Imagick I normally use version 6.8.6-8 Q16.
Please note I've only ever really done this on Windows 7 and Windows Server 2008, 2008 R2, 2012, and 2012 R2 all x64 with x86 PHP
If this still doesn't work then you probably need to copy over the CORE_RL files into your Imagick directory this normally causes more issues but if you are running out ideas then give it a go
I just ran into this issue. Only I'm using PHP on the command line (PHP CLI). The problem is the dependencies that the main php_imagick.dll file has. PHP will attempt to load the extension but since Windows can't find the CORE_RL_ DLLs, the extension will fail to load and the error/warning message about being unable to load the DLL will appear. It helps to know how Windows loads DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
It's pretty convoluted but you can see that the reason the Apache /bin directory trick works with Apache is that httpd.exe is located in that directory. However, when using PHP CLI, the DLLs need to be located in the same directory as php.exe.
If you don't want duplicate DLLs floating around, add the directory containing php.exe to the system PATH and plop all the CORE_RL_ DLLs there. The PATH is the last thing searched, but it'll work fine. If you don't want spurious entries in your system PATH, then set the extra PATH information only during startup of Apache.
This is because the dependencies are missing. Those who are facing the same error Unable to load dynamic library 'php_imagick', Please follow the below steps
Go to https://pecl.php.net/package/imagick choose a stable version and click on the DLL link.
From the DLL list click the link which, is suitable for your PHP version.
After downloading the php_imagick zip file, extract it and copy the php_imagick.dll file to C:\xampp\php\ext folder.
Extract all DLL files from the php_imagick zip file (except php_imagick.dll) to the PHP root directory (where you have php.exe). Ex: For XAMPP user C:\xampp\php folder.
Add extension=php_imagick to your php.ini file.
Restart the Apache server.
Things to keep in mind before choosing from the DLL list.
Check the PHP version.
Check the architecture (x64/x86).
Check Thread Safety (enabled/disabled).
N.B: Above solution is for XAMPP users only.
I changed php_imagick in php.ini file to php_imagick.dll and it happened
I had the same problem. It turns out I have to install complete ImageMagic application, not just ImageMagic php extension.
And I also set MAGICK_HOME environment variable.

php: loading oracle driver gives error "Unable to load dynamic library - The specified procedure could not be found."

I seem to have a strange problem with PHP.
I've migrated a bunch of software from one server to another. On the server some scripts make a connection to Oracle, so to be able to make a connection the oracle client is installed and a tnsnames file is in place. Connection from sql*plus works.
Some of the scripts use PDO, so for that I've enabled extension=php_pdo_oci.dll in php.ini. These scripts work like a charm.
Some other scripts use functions like oci_connect, and these need a extension like php_oci8.dll. With xammp (that I use as apache/php/mysql bundle) php_oci8_12c.dll is delivered, so I thought that extension would be adequate.
When starting the server, I see these errors in the php errorlog:
Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found.
The file is in located in C:\xampp\php\ext\, so that shouldn't be a problem. Other extensions that are in the same dir are picked up without any problems. I've also tried to load php_oci8.dll, wich I picked up from the old server, but got exactly the same problem.
Some answers I found to similar problems I tried without success:
- copying the dll to c:\windows\system
- adding the php ext dir to the system PATH variable
- adding the oracle client to the system PATH variable (was already in there)
The software versions I'm using:
OS: Windows 2012 R2 x64
PHP: 5.6.3
Oracle database: 11.2.0.4.0
Any ideas?
Seems like I figured it out and can answer my own question. It looks like XAMPP is delivering a non-suitable ddl with their distribution.
The right and most recent oci8 dll's are downloadable here in all possible flavors: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/. Once I got the right one, it worked like a charm.
XAMPP comes with PHP compilled with ThreadSafe, so you have to download the file from this directory:
http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/ …
Before you paste the 3 DLLs to C:\xampp\php\ext*, append ".old*" to each file. Be sure you have enabled the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache.

Load php_oauth.dll into local server

I'm facing problem to load the php_oauth.dll extension for my xampp. I downloaded the php_oauth.dll and added extension=php_oauth.dll in php.ini , but when i restart my apache, it cannot start the server anymore.
I'm using window 7 ,64bits.
Initially, I download the file from
http://downloads.php.net/pierre/
but i found that it was 32bits file , so I'm searching fo 64bit and found out
http://www.mediafire.com/php-win64-extensions
unfortunately,I still cannot load the oauth. Any solution to solve it? I look through many article, but it seems like dont have it, anyone can provide ,so that, others that using win 64bit can follow
Thank you!
This looks to be like a path problem. Make sure the extension is store in the correct extension directory.
The settings of this can be found inside php.ini as something like
extension_dir = C:\php\extensions
By default this is ext folder inside PHP installation.
Or, follow the instruction from PHP manual while installing extensions, if you are not sure what you are doing.

php_zip does not exist in php 5.3.5

I'm in the process of using PHPExcel. One of the requirements is that I need to enable php_zip.
(...) if you need PHPExcel to handle .xlsx or .ods files you will need
the zip extension...
I'm using PHP v5.3.5. and in my php.ini file, I have the following lines:
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
If I remove the ; in the last line, and restart Wampserver, I get the following error message:
PHP Startup: Unable to load dynamic library
'I:/wamp/.../ext/php_zip.dll' - The specified module could not be
found.
Reading the web, many says that as of PHP 5.3.0, php_zip is built-in.
If it is built then why is this line still in the configuration?
Do I get the error message because since it's built in, the file has been removed?
PS. Sorry if this is in the wrong forum, but not sure where else to put it.
In fact, Zip is included by default. It is a bug that the line is still included.
marc answer is right. I wanted to add a comment that using
extension_loaded('zip');
returns false as it is no longer an extension, you could use
class_exists('ZipArchive');
to check for it now.
I've had a similar problem with a different library. WAMP doesn't include many libraries by default for some reason.
What I did was download the full PHP installation as a zip from php.net and the required dll was found in the extensions folder just as it is in WAMP. I just copied it from the zip to the WAMP extension folder and it worked fine.

Categories