i am using MAMP server i am trying load a extension in my php but i am getting error, i tried everything but i cant make it load :(.
i am using mac os and php 5.6.7
that line is for the extension: extension=protocolbuffers.so
i inserted in: Applications/MAMP/bin/php/php5.6.7/conf/php.ini
i inserted too in: /Applications/MAMP/conf/php5.6.7/php.ini
and still not loading.
i run that php file called: extension.php to see if my extension is loading.
so i got the error so i definitely not loading the extension:
Fatal error: Call to undefined function dl() in /Applications/MAMP/htdocs/ci-match/extension.php on line 3
<?php
if (!extension_loaded('protocolbuffers')) {
if (!dl('protocolbuffers.so')) {
exit;
}
}
?>
i use too php
print_r(get_loaded_extensions());
?>
but i cant see my extension there, how can u guys help me to load that extension?
can you guys help me with that? thank you.
Besides the fact that the dl()-function has been removed completely from a number of SAPIs, it usually is disabled for security reasons.
I'm not sure whether the disable will result in an undefined function error or in a security error of some kind. Guess you'll have to find out.
You can control access to it using the enable_dl-directive in php.ini and by making sure safe mode is not enabled.
As for your attempts to load the extension:
I WOULD run a .php file with phpinfo(); in. That will tell you which .ini files are being loaded and where the extension directory is.
You can then use that information to add it in the correct location. Chances are that your MAMP loads from a weird location.
It's very hard to diagnose issues like that remotely.
Related
Another one for this error that is driving me nuts.
I've read literally 50 posts in stackoverflow and tried all different solutions:
Checking php.ini to see if the extensions are enabled and the folder to check if the dll's are present
Also tried extracting a php_pdo_mysql.dll file from the latest php version, checking if maybe the xampp original file was broken or corrupted with no luck.
Setting the path in environment variables
This is what I'm using for my local environment:
Xampp 7.2.4
PHP 7.2.4
Apache 2.4.33
And this is my code:
return new PDO('
mysql:host='.Env::getInstance()->env('dbhost').';
dbname='.Env::getInstance()->env('dbname'),
Env::getInstance()->env('dbusername'),
Env::getInstance()->env('dbpassword')
);
Is there something I haven't tried? please I want to fix this issue for once and for all.
Thanks in advance.
The arguments passed to the PDO constructor must be like $dsn in the example of the php manual below.
<?php
/* Connect to a MySQL database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
?>
It looks like your first argument has the wrong content.
I would like to change php version to 7.1 and i have an error:
PHP Warning: PHP Startup: Unable to load dynamic library
'C:\Program Files\PHP\v7.1\ext\php_sqlsrv_7_nts_x86.dll' - The specified procedure could not be found.
in Unknown on line 0
First think. This is not duplicate question because i checked many similar questions.
I'm using IIS, PHP 7.1, and SQL server (thats why i need sqlsrv drivers).
I checked php.ini file aready and i change extension-dir path to full path but nothing happens. (Logically if path is a problem why it works with other extensions? ).
It works with PHP 7.0.7 (all enabled extensions is exactly same)
Update: still won't work but i tried to paste path from error message to file explorer and file already there.
Turns out that PHP 7.0 and PHP 7.1 are not compatible and the mssql PDO drivers are for 7.0.
Github issue here
Also ensure you including the right 64/86 and ts/nts version.
As from Toby Allen's accepted answer above 7.0 and 7.1 are incompatible,
However Microsoft has released Preview versions of the drivers for 7.1.
This worked for me, hope it helps anyone searching.
Drivers can be found here under downloads
I had this issue yesterday. The key to the error is the last bit.
The specified procedure could not be found.
In my case I went through a painful amount of debugging. The first thing that I noticed was that when I ran a hello world php file, I didn't get this error. That indicated to me it wasn't actually a problem loading the file, it was a problem calling a function in the file.
I went in and repeatedly put die() statements in and moved it until it hit the error. It took awhile but I eventually discovered I was calling sqlsrv_connect with options that were (apparently) now invalid.
So I can't say the exact cause of your issue without seeing the code that actually causes the error, but I hope this at least points you in the right direction.
I am receiving this error when I try to access my newsletter plugin, I have uncomment the curl extension in both php\php.ini and apache\php.ini, and also in configuration file of php. Even I restarted my server after changes but still I am getting error. How can I solve this issue ??
I have tried these extensions (extesnions link here) according to my php version and it worked!
Cheers
Start the Curl extension of PHP directly by changing PHP.ini file or by clicking wamp and then scroll to PHP->extensions
I changed the default PHP version to an older one (5.3.28) but when I try to jump in to PHPMyadmin I get the error
*Fatal error: Call to undefined function mb_detect_encoding() in C:\xampp2\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177*
Browsing trough this forum I found that this means I need the mbstring library
I enabled it in php.ini like this:
extension=php_mbstring.dll
But I keep receiving the same error.
I checked the extensions directory
extension_dir="C:\xampp2\php5328\ext"
and its correct, and the extension file is there as well (php_mbstring.dll)
But when I load phpinfo() I cant find any mention of mbstring.
Any ideas?
Got it solved #.# I was clicking config in XAMP and I thought it would for some reason open automatically the old php file (even tho Xampp is already configured to use the new one)
So yeah X) I was modifying the wrong php.ini
Thanks!
Background:
I'm trying to get tweets from a specified username using PHP and OAuth. This example seems very useful. My problem is that my code doesn't return from the $feed = curl_init(); line near the bottom. There are no errors displayed, I only know that it stops because my debug statements after that line are not executed.
I didn't have cURL installed so I installed it on my Windows machine (using this example). It still doesn't produce any errors, it just leaves and never comes back.
Question:
How do I access cURL from my PHP program where I want to use it?
You need to download the windows php zipped manual installer from windows.php.net, the manual zip comes with all the extensions. Once php has been installed, enable the CURL extensions.. and any other extension that you need in the php.ini file. Copy the php-production.ini to %systemroot% directory and rename it to php.ini.
Hope that helps !!!