I'm using PHP 5, Windows (IIS), and when i try access the file from command line, i get the following error (via browser, everything works great):
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
My current code is:
$connection = odbc_connect(DATABASE, 'user', 'user', SQL_CUR_USE_DRIVER ) or die (odbc_errormsg(). "Error");
Also have this extension:
extension=php_sqlsrv_52_nts_vc6.dll
extension=php_pdo_sqlsrv_52_nts_vc6.dll
I read to uncomment (php.ini) line with code php_odbc.dll, but i don't have these line and file.
Any tips to help?
Thank you!
I have the IIS and xampp installed and the problem is the environment variables.
I changed the path C:\xampp\php to C:\php and now, works like expected.
Related
While I trying connect svn using php svn package in windows xampp and I got the below error.
Uncaught Error: Call to undefined function svn_auth_set_parameter()
I have followed
https://www.php.net/manual/en/svn.installation.php manual and installed svn module in php and enabled extension=php_svn in php.ini file.
Here the sample code I have used
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'my username');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'password');
Although calling the same script through browser work fine, trying to trigger the same script via CLI didn't work!
The way I have to call the script I use CodeIgniter structure :
php index.php controller/function/parameter
I have also change in config file of my project:
$config['uri_protocol'] = 'AUTO'
But the problem that oci can't work within cli although it works by calling it using the browser.
THis error appear:
Fatal error: Call to undefined function oci_connect() in C:\wamp64\www\MYPROJECT\syst
em\database\drivers\oci8\oci8_driver.php on line 238
Severity: Error Message: Call to undefined function
oci_connect() Filename:
C:\wamp64\www\MYPROJECT\system\database\drivers\oci8\oci8_driver.php
Line Number: 238
I have enabled the oci extension at php.ini
extension=php_oci8_12c.dll
which is existed in the following directory:
C:\wamp64\bin\php\php5.6.19\ext\php_oci8_12c.dll
env:
CentOS 6.5
php5.5.3 / php-fpm5.5.3
nginx 1.0.15
php-redis 2.2.8
also added extension_dir and extension settings in php.ini
then restart the service of php-fpm & nginx
and i have confirmed the redis has been enabled/loaded in phpinfo()
step:
i'm trying to run the php script like this
<?php
$redis = new Redis();
?>
got error:
PHP Fatal error: Call to undefined function new Redis() in /home/html/test1.php on line 2
but when i'm trying to run the same command in php Interactive shell mode, it works well.
why?
update:
i have test a script like this:
print_r(get_loaded_extensions());
then i got already loaded extension redis
if(class_exists('Redis')){
echo 'Redis loaded';
$redis = new Redis();
}else{
echo 'not function Redis';
}
it shows class Redis exist but still get error
[root#i1 html]# php -f test1.php
Redis loadedPHP Fatal error: Call to undefined function new Redis() in /home/html/test1.php on line 16
add dl("redis.so"); and the output:
PHP Warning: Module 'redis' already loaded in Unknown on line 0
Redis loadedPHP Fatal error: Call to undefined function new Redis() in /home/html/test1.php on line 18
finally, i cant config to use the phpredis plugin.
predis is the better choice in this case.
I am trying to set up phpMyAdmin, and i was following this site , but i got an error about "Fatal error: Call to undefined function mb_detect_encoding() in C:\Users\Jarek\mywebsite\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177", and i searched this error online, Most of suggestion are uncommon some lines in php.ini, but it didn't work for me.
This is the site tell you how to solve problem with this error.
solve 1
solve 2
php.ini is in my php folder which is located in c diver.
prompt command to check path
Every time i changed config, i also did restart apache.
I also tried to write some piece of code of php as below:
$con=mysqli_connect("127.0.0.1","root","xxxxxxx","morris_db");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
and open my browser, and type localhost/index.php, it shows me an error about "Fatal error: Call to undefined function mysqli_connect() in C:\Users\Jarek\mywebsite\index.php on line 8"
Try adding these extensions in the PHP.ini
extension=php_mbstring.dll
extension=php_gettext.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
Also check whether the PHP folder exists in the PATH.
I'm trying to print some string using PHP, i'm using the PHP print functions:
$printer = ("HP LaserJet Professional P1102");
$handler= printer_open($printer);
$content="Test Content";
printer_write($handler, $content);
printer_close($handler);
but I got that error :
Fatal error: Call to undefined function printer_open() in C:\xampp\htdocs\print.php on line 12
after googling it i found that i must add the php_printer.dll to the extensions file in php and add it's extension to the php.ini file, then restarting the server services, all of that accomplished but still getting that error.
p.s. I've tried it on WAMP and XAMPP
I think solution would be extension location.php_printer extension should be stored in c:\xampp\php\ext and not in c:\xampp\php. So move it to the ext-folder, and restart Apache.
Can you look into the error_log, which tells you, if it fails to load the module. You should also run a phpinfo(), which shows up all loaded modules, you must find the printer extensions there.
I hope it may resolve your issue.