XAMPP / MySQL / Undefined function mysql_connect() - php

I am having a problem with a small class project. I have installed XAMPP, created the table that I need, loaded my *.sql database in it, but my project can't run because of some PHP issues I guess.
I had the $_SESSION problem, which I found a solution to, but then...
I am getting the famous:
Fatal error: Call to undefined function mysql_connect() in C:\xampp\htdocs\gabi\telk\DbSql.inc.php on line 11
But I can't bypass the problem. I have read other threads on this problem here but neither of them solves the problem for me.
Here is my code that is inside the DbSql.inc.php :
http://codepad.org/ToGmPB26

Check in your php.ini file if you have the line:
extension=php_mysql.dll
And it's not commented (with the ; in the line start)

Related

PHP 7 include file error - file name is parsed incorrectly

Recently I met a weird error and hope someone can help.
We use LiteSpeed WebServer and Nginx on top, with PHP 7.5 and MySQL 5 (well, WordPress is the framework). It runs well for many days.
Suddenly it goes fatal at this line in different files
include ("class-xxx.php");
The error log says
[02-Oct-2018 13:04:36 UTC] PHP Fatal error: require(): Failed opening required 'dlass-xxx.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear') in /xxx.php on line N
I double checked the code and see that the file name is declared "class-xxx.php", but somehow the server tries to include "dlass-xxx.php", thus it cannot find the file and trigger fatal error.
Solution? I re-upload the file, it works. But then it goes fatal in another file, at similar lines using include.
I notice that the first character in the file name, for example "c", is read incorrectly and shift 1 byte before (or after), so the file name is correct.
Such as
include "class-xxx.php" is parsed/read as "dclass-xxx.php"
include "page-xxx.php" is parsed"read as "opage-xxx.php"
...
this is very strange. Do anybody know the reason? Is it related to any caching/memory management of LiteSpeed or Nginx or PHP 7. ?
It happens on PHP 7. only because if I switch to PHP 5.6, the error does not happen.
Hope someone can help. Thanks a lot.

connecting PHP to MSSQL error

I'm currently trying to connect to a MSSQL database, but from what i've read so far, there are actually extensions and files that i need to download from microsoft itself which i've went and download it here.
https://www.microsoft.com/en-us/download/details.aspx?id=20098
The error that i'm receiving currently receiving is the following.
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\xampp\htdocs\index.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\index.php on line 5
As far as i understand, i know that i'm supposed to append some extensions into the php.ini located in my xampp\php\php.ini file. However, even after appending the file from microsoft, i still can't seem to get connected.
I heard some people mentioned that the php version that i'm using which is currently PHP Version 7.1.1 has some issues connecting back to MSSQL databases but i'm not entirely sure.
Would someone be able to point me to right direction? i've tried looking up and down appending different files into the extension but i still can't seem to do it.
Thank you very much in advance.
edit:
PHP 7 on IIS: Call_user_function could not be located
i've also visited this link, however i'm unsure whether if this is related to the issue I have as i'm on 7.1

Fatal Error on Wordpress: Call to undefined function wp() in wp-blog-header.php

I updated Wordpress to 4.2 this morning, and now I can't access my Wordpress site, gteam.org.
I've searched the Wordpress help forum, but to no avail.
Thoughts or help:
Fatal error: Call to undefined function wp() in /home/team1874/public_html/wp-blog-header.php on line 14
I got the same error, problem was my wp-config.php file was somehow empty, just copied the example wp-config and added my configuration and it worked again.
I met the same problem this morning when trying to install wordpress v4.9.4 . The most likely reason is that the file which declared function wp() is somehow damaged. I solved it reload a new package and installed.
references:
https://wordpress.org/support/topic-tag/fatal-error-call-to-undefined-function-wp/

Fatal error: Call to undefined function mysqli_connect() while extension are set properly

I've searched in "google" a lot but I have not found a perfect answer. I've seen many questions in "stackoverflow" too but these do not describe my problem.
Fatal error: Call to undefined function mysqli_connect() and Fatal error: mysqli_connect() these two question are close to my problem,but these are not solving my problem,anyway my problem is:
I've written php code which will connect my mysql database server.
<?php
echo "entering db";
$link=mysqli_connect('localhost','root','qwerty');
echo "entered";
?>
NOTES :
I've edited
extension_dir = "C:\PHP\ext"
extension=php_mysqli.dll
result of
ini_set('display_errors', 1); error_reporting(E_ALL)** ; is the same **Fatal error: Call to undefined function mysqli_connect()
I have executed echo 'ini: ', get_cfg_var('cfg_file_path'); and
its displaying C:\PHP\php.ini
I am using Apache 2.2.11 and PHP 5.2.17 and MySQL 5.5 does anyone have any idea,whats wrong there?
And I've "PHP_MYSQLI.DLL" In EXT folder.
EDIT :
surprisingly there is no information about database server in phpinfo().can anyone tell me now what is the problem.
EDIT 2:
which one to download non thread safe or thread safe..i have downloaded non thread safe
i dont know it will help others or not..but still i am giving this answer because i didnt get any proper solution here.i have tried all error check and i am sure there was no mistake in my code.and as i said all the extensions were properly loaded i didnt have any proper solution to that.i un-installed all my set up and install wamp instead of installing all the packages individually.the same code is running perfect now in wamp

why would mysql_connect randomly not work?

I have mysql_connect running with no problem on my site...
I have a script that i'm running from a CRON job, and here it decides to not work, and output these two errors:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ssh2.so' - /usr/lib64/php/modules/ssh2.so: cannot open shared object file: No such file or directory in Unknown on line 0
Fatal error: Call to undefined function mysql_connect() in /home/mysite/public_html/phpMySQLAutoBackup/files/schema_for_export.php on line 22
Yes, I'm using phpMySQLAutoBackup
Any ideas? This befuddles me...
The time I got one of these (Unable to load dynamic library ...) I was missing a module. In your case my guess would be that you're missing "libssh2"
Similar to PHP Errors on a cronjob, works fine at prompt
Check your $PATH, permissions, & any environment variables...

Categories