mysql_connect() shows error in php5 - php

I have using php5-mysql system-Ubantu 13.10, I setup my project but when i login for my first page it give me [:error] [pid 16033] [client 127.0.0.1:53154] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/Scada/Fleet/phpcmd/login.php on line 29, can you please tell me how I can make my environment compatible to work with the code.

change Line 29 /var/www/Scada/Fleet/phpcmd/login.php on line 29
from mysql_connect() to mysqli_connect()
you have to change all mysql statements to mysqli statements to get it work.
Or you use PDO.

Do
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
in your index.php or the first line of /var/www/Scada/Fleet/phpcmd/login.php
or use mysqli or PDO instead of the old mysql extensions.

Related

How to connect to MS SQL Server 2016 from PHP 7

I'm attempting to insert rows in table in a database hosted in MS SQL Server 2016 installed in my local computer.
Here is my snippet $dbc = mssql_connect('MwangiCJ-PC/mwangi','sqluser','xxxx','mydb');
I have tried out the answer from
mssql_connect() with PHP5 and MSSQL2012 Express but I still get the error Fatal error: Uncaught Error: Call to undefined function mssql_connect()
When i run a simple phpinfo() I can see that I already have both sqlsrv and pdo_sqlsrv available.
Am I missing anything else? Please help. Thank you.
From the PHP docs:
Warning
This function was REMOVED in PHP 7.0.0.
Alternatives to this function include:
PDO::__construct()
sqlsrv_connect()
odbc_connect()

Codeigniter Deprecated: mysql_real_escape_string():

Got below error while using codigniter 3.0
FYI using PHP Version 5.5.12,Apache Version Apache/2.4.9 (Win64) PHP/5.5.12
A PHP Error was encountered
Severity: 8192
Message: mysql_real_escape_string(): The mysql extension is deprecated
and will be removed in the future: use mysqli or PDO instead
Filename: models/common_model.php
Line Number: 21
Backtrace:
File: C:\wamp\www\Codeigniter\application\models\common_model.php
Line: 21 Function: mysql_real_escape_string
Go to application => config => database.php and change from
$db['default']['dbdriver'] = 'mysql';
to
$db['default']['dbdriver'] = 'mysqli';
Note It is recommended to use query builder class for queries.
use mysqli_real_escape_string();
and replace mysql to mysqli in every functions.
You should use PDO in codeigniter to solve all problem related to mysql and mysqli..
see how to use PDO in CI
if you are using CI 3 then http://www.codeigniter.com/user_guide/database/configuration.html
and if you are using CI 2.x
How to use pdo in codeigniter?

CodeIgniter and PHP 5.5.14 - mysql_escape_string() issue

I've this issue after setting up CodeIgniter with PHP 5.5.14
A PHP Error was encountered
Severity: 8192
Message: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.
Filename: mysqli/mysqli_driver.php
Line Number: 320
It seems that mysql_real_escape_string() functions has been deprecated on 5.5.14, right?
CodeIgniter have no compatibility with this PHP version??
Any ideas??
Thanks in advance!
Giovanni
There was an error with the MySQL configuration (I'm on a MacBook Pro).
In practice, mysql's tmp path must be setup on mac.
After this step, my issue has disappeared!

After migrating a website with MYSQL DB the website (PHP) displays an error. what does the error mean?

I am still pretty new to everything. So if you need any more information, let me know.
What I did so far :
I copied a website from one ubuntu 10.10 server to another 12.04 ubuntu server.
I also backupped and restored the MYSQL Database.
I configurated apache2 (which is right now just locally) to display my page.
I have 3 Pages on 3 ports, the other pages work, so I probably configurated apache2 correctly.
At first i just saw a blank page, when I tried to contact my website, so I switched on the error screens.
This is what appears , I replaced the websitename to xxxx :
Deprecated: Function set_magic_quotes_runtime() is deprecated in /data/xxxx/www/index.php on line 11
Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 311 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 385 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 923 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX/Server.php
on line 161 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX.php
on line 612 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX/Serializer/JSON.php
on line 46 Warning: include_once(../pear/Net/Socket.php): failed to open stream: No such file or directory in /data/xxxx/www/pear/Net/SMTP.php
on line 25 Warning: include_once(): Failed opening '../pear/Net/Socket.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
in /data/xxxx/www/pear/Net/SMTP.php on line 25 Warning: include_once(PEAR.php): failed to open stream: No such file or directory in
/data/xxxx/www/pear/Mail/mime.php on line 65 Warning: include_once(): Failed opening 'PEAR.php' for inclusion
(include_path='.:/usr/share/php:/usr/share/pear') in /data/xxxx/www/pear/Mail/mime.php on line 65 Warning:
include_once(../pear/Mail/mimePart.php): failed to open stream: No such file or directory in /data/xxxx/www/pear/Mail/mime.php
on line 75 Warning: include_once(): Failed opening '../pear/Mail/mimePart.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
in /data/xxxx/www/pear/Mail/mime.php on line 75 Deprecated: Assigning the return value of new by reference is deprecated in
/data/xxxx/www/pear/Spreadsheet/Excel/Writer/Workbook.php on line 180 Deprecated: Assigning the return value of new by reference
is deprecated in /data/xxxx/www/pear/Spreadsheet/Excel/Writer/Workbook.php on line 189 Deprecated: Call-time pass-by-reference
has been deprecated in /data/xxxx/www/modules/statistics/frontend.class.php on line 16 Deprecated: Call-time pass-by-reference
has been deprecated in /data/xxxx/www/modules/users/frontend.class.php on line 19 Deprecated: Assigning the return value of new
by reference is deprecated in /data/xxxx/www/pear/DB/common.php on line 958 Deprecated: Assigning the return value of new by
reference is deprecated in /data/xxxx/www/pear/DB/common.php on line 1150 Notice: DB Error: connect failed in
/data/xxxx/www/classes/registry.class.php on line 70
the only thing I understand here is : Simple Mail Transfer Protocol (SMTP)
it seems that some data was not copied correctly.
How to check the excat size of the folder and subfolders? so I can compare at least :)
Thanks in advance.
ANY HELP will be upvoted very fast.
set_magic_quotes_runtime()
Just get rid of this function call.
Assigning the return value of new by reference is deprecated in
Just get rid of & sign in the statement.
Warning: include_once(PEAR.php):
You have to install PEAR
It appears you have changed PHP versions. Very likely that your Ubuntu 10.10 box was running PHP 5.2.x or PHP 5.3.x and now your Ubuntu 12.04 box is running PHP 5.4.x or PHP 5.5.x (low chance).
You have two real solutions:
Update your code (recommended)
Go in line-by-line and update your code and correct the errors, you should be able to research those errors individually and use http://php.net/ as a resource.
Downgrade your php/mysql version
You can check your old PHP version on the Ubuntu 10.10 box by running the following command in terminal: php -v; then do the same command on your 12.04 box to see what you have upgraded to.
There is plenty of documentation out there for changing PHP versions on Linux, so I empower you to do that research.
You will also want to copy your php.ini configuration over to the new install also--it's very likely you have some ancient configurations by the looks of your magic_quotes errors.

Php ESP not running into php 5.3.4 version or later

I want to run phpESP on my local pc. But I'm getting lots of errors. How can I run this without any error?. It shows me errors like this:
Deprecated: Function split() is deprecated in C:\xampp\htdocs\zrg\phpESP\admin\include\lib\espi18n.inc on line 66
Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\zrg\phpESP\admin\include\lib\espi18n.inc on line 72
Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\xampp\htdocs\zrg\phpESP\admin\include\funcs.inc on line 23
Fatal error: Call to undefined function session_register() in C:\xampp\htdocs\zrg\phpESP\admin\manage.php on line 29
Did you grab the latest copy of phpESP? A version came out only a few months ago that must surely support a recent PHP. Also you need to update your version of PHP, yours is pretty old.
http://sourceforge.net/projects/phpesp/

Categories