oci_connect() can't connect - command Line with codeigniter - php

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

Related

Call to undefined function odbc_connect via command line (cmd) PHP5

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.

phpredis: got error when running script Call to undefined function new Redis()

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.

Getting error when trying to install POS on Localhost : Fatal error: Can't use method return value in write context

I am trying to install opensourcepos from https://github.com/jekkos/opensourcepos
But I am getting this error:
Fatal error: Can't use method return value in write context in D:\Xampp\htdocs\opensourcepos\application\helpers\locale_helper.php on line 67
A PHP Error was encountered
Severity: Compile Error
Message: Can't use method return value in write context
Filename: helpers/locale_helper.php
Line Number: 67
Backtrace:
I followed instructions, this is a brand new install, I'm at a loss...
I'm on WIndows 7, using Localhost with Xampp
The line 67 is question is this one:
if (empty($config->item('thousands_separator')))
When I comment it out, the site loads, but it doesn't work
check readme txt
You are getting following error Message: Can't use method return value in write context saying that you are probably using PHP7 which is not completely supported yet. Check your hosting configuration to verify whether you have a supported PHP version installed

Database Error mysqli_init()

I just changed my server and now I'm getting the following error;
Fatal error: Call to undefined function mysqli_init() in /home/site_address/public_html/system/database/drivers/mysqli/mysqli_driver.php on line 125
What's the problem and how to solve it?
Note: changes dbdriver from mysqli to mysql also getting error
Go to your php init file and uncomment the following extension:
extension=php_mysqli.dll

command line php,socket

I tried to run in my localhost (WAMP) a php code with a socket,and it work great in the browser ,but whan i tried to do the same in the command line it's throw exception "the function socket_create is not exists" .
So I tried to check if php_sockets extintion is enabled and it is,so it still doesn't work ,someone has crossed with that before ?
here is the exception :
PHP Fatal error: Call to undefined function socket_create() in
C:\wamp\www\sock et\serverc.php on line 2 PHP Stack trace: PHP 1.
{main}() C:\wamp\www\socket\serverc.php:0
Fatal error: Call to undefined function socket_create() in
C:\wamp\www\socket\se rverc.php on line 2
Call Stack:
0.0010 230696 1. {main}() C:\wamp\www\socket\serverc.php:0
PHP in CLI mode on Windows uses the php.ini file located in C:\Windows (see http://php.net/manual/en/configuration.file.php). So check here if php_socket is enabled.

Categories