Call to undefined function sqlite_escape_string() - php

i am using sqlite_escape_string($str) to prepare sql statements for future use.
however, when i migrated my code to a new server, it says:
Call to undefined function sqlite_escape_string()
seems the Sqlite and everything is working in the new server, but i have error even for a sqlite_open().
Anyways, i just need to escape my $str to a sqlite safe sql statments, i dun even need to write to sqlite from PHP, so an

That sounds like the SQLite plugin is not enabled for PHP. Write <?=phpinfo()?> in a .php file, load it up on your server and see if SQLite is mentioned in the loaded plugins.

You need to uncomment the extension=php_sqlite.dll line by removing the semi colon right now your pdo_sqlite is enabled and sqlite_escape_string is a function of sqlite extension and sqlite_pdo will not work untill php_sqlite is enabled

I found the ans myself.
It is due to my server is a Centos 5.4, and sqlite support for php is not there.
The same case should exist in REL5 also.
see the 1st and 2nd latest comment in the link below:
http://www.php.net/manual/en/sqlite.installation.php
I solved it by recompiling my php and added the sqlite.ini file

For those who recently upgraded to 5.4+, note that the php docs say, this method is not available 5.4+
(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)
So you would either need to manually compile it in, or look at PECL.

Related

How can I use mssql functions on php? I don't have php_mssql.dll in my extensions folder

I'm trying to use SQL Server with PHP but I don't know how to install this feature. I have enabled extension=php_mssql.dll in my php.ini file but after restarting apache I got a error message saying that don't found the DLL file.
After much attempts I reinstalled XAMPP 1.81, and I'm starting now from zero.
Thanks for any help.
Edit MSSQL has been discontinued as of 5.3
I believe the correct driver is php_sqlsrv.dll.
http://www.php.net/manual/en/sqlsrv.installation.php
Here are the available functions: http://www.php.net/manual/en/ref.sqlsrv.php

Undefined Constant MYSQLI_ASYNC - Non blocking queries in PHP

I understand that mysqlnd allows non blocking queries. However, I'm trying:
// goes without saying this code works correctly when second parameter is ommitted
$link->query($myQuery, MYSQLI_ASYNC);
The error I get is:"Notice: use of undefined constant MYSQLI_ASYNC assumed 'MYSQLI_ASYNC' "
and ensuing errors.
PHP Version: 5.3.5-1 ubuntu7.4
I don't know if I actually have mysqlnd installed/activated, and I can't find a good resource on how to tell if it is.
Help?
The most likely cause for this is that the mysqlnd extension is not installed. Please note, according to docs any PHP version less than PHP 5.4 will need to explicitly configure to use mysqlnd; starting with PHP 5.4 mysqlnd will be enabled by default.
There are a couple different ways to tell if you have an extension loaded.
phpinfo() should output a section labeled mysqlnd
extension_loaded('extension_name') should return true/false whether or not you have the extension loaded

mysql_connect not defined

I'm testing a connection to mysql 5.1, with php5 on apache2 (windows).
I have made a regular php test connection page from a tutorial but I'm getting the error "mysql_connect" not defined.
In eclipse for php, I see the function defined under the language library. However when I make a page:
<?php
phpinfo();
?>
I don't see mysql functions or anything there; can someone tell me why? I thought PHP5 at the least would support MySQL, no?
The MySQL extension is probably not enabled. If you look through the php.ini file, you should be able to find the appropriate line. phpinfo() will show the location of the php.ini file.
there is php documentation
http://php.net/docs.php
mysql_connect
http://php.net/manual/en/function.mysql-connect.php
however mysql extension should be enabled in php.ini
(linux: /etc/apache2/)

extension=php_mssql.dll - error load

I am configuring a server IIS7 to work with php and mssql in php.ini and when I try to call the "extension = php_mssql.dll" appears to me an error when I refresh the site.
"500 - Internal server error.
There is a problem with the resource you are looking for, and it can not be displayed. "
Thanks
The php_mssql.dll is missing the latest 5.3 releases because support for this extension has been dropped. Version 5.3.1 stills has a version which you can also use in 5.3.5. Just copy it to the ext dir.
You don't mention your PHP version, but here's a relevant article that suggests two DLLs that may be missing:
http://forums.iis.net/t/1164387.aspx
But note that the key message of the article is that php_mssql.dll depends on an old MSSQL driver that's no longer supported, so moving to the new Microsoft PHP MSSQL driver seems to be a good idea.

How to set up OCI to connect to Oracle from PHP?

On the latest Ubuntu, I have a functioning PHP 5.2.4 installation. I want to use a remote Oracle server from PHP using OCI.
I've downloaded the "Instant Client Package - Basic Lite" (Link). I've unzipped the package containing the OCI libraries to a dir but I have no idea how to tell PHP that I want to use these libraries. Predictably, I get
Fatal error: Call to undefined function oci_connect() in...
when running this code:
<?php
$conn = oci_connect('hr', 'hrpw', 'someremotehost');
?>
I don't want to recompile PHP with Oracle support. What's the fastest way to wire up PHP so that I can use Oracle? Do I need any other libaries, like the Oracle client if I want to connect to a remote Oracle instance?
You need the PHP extension, try the following on your Ubuntu:
(sudo) pecl install oci8
Make sure your php.ini's (there should be one for your Apache and one for cli php) contain extension=oci8.so afterwards. Finally, you have to restart Apache and can confirm via <?php phpinfo(); ?> that the extension is loaded.
UPDATE:
Enter something like this when it asks you for ORACLE_HOME:
instantclient,/opt/oracle/instantclient
I think setting the environment variable would be another solution. /opt/oracle... is the path I put my instantclient in. I followed some tutorial a while ago, unfortunately I can't find it anmore.
HTH
I think you'll need to make sure that the $ORACLE_HOME/lib32 is in your $LD_LIBRARY_PATH, or else add that directory to the /etc/ld.so.conf file.
In the end, I downloaded Zend Core for Oracle and that worked.
http://www.zend.com/en/products/core/for-oracle

Categories