using cpanel database after copy it to local machine - php

I am trying to shadow a live website to my local machine, I have finished all the copy thing for home folder and database from cpanel.
So far, I didn't make any change on code part, and just installed xampp and set up phpmyadmin.
after I set the localhost, and loaded the local page then below message displayed.
Fatal error: Uncaught Error: Call to undefined function
mysql_connect() in F:\htdocs\ramtaps\includes\php_library.inc:41 Stack
trace: #0 F:\htdocs\ramtaps\includes\php_library.inc(19):
phpLibrary->createGlobalDatabaseConnection() #1
F:\htdocs\ramtaps\includes\php_library.inc(469):
phpLibrary->__construct() #2
F:\htdocs\ramtaps\includes\config\master.php(859):
include('F:\\htdocs\\ramta...') #3 F:\htdocs\ramtaps\index.php(4):
include('F:\\htdocs\\ramta...') #4 {main} thrown in
F:\htdocs\ramtaps\includes\php_library.inc on line 41
So I looked into the code and it said that mysql_connect is deprecated.
I am pretty new one this field and tried few things and they didn't work so far.
If anyone advises me regarding on this, I would really appreciate.

although you did not mention your PHP version, it is obvious that you are using PHP with version > 7
mysql_connect was removed in PHP 7.0.0 and above
http://php.net/manual/en/migration70.incompatible.php
either install older version of PHP, or change your code
and maybe this is usefull for you http://php.net/manual/en/mysqlinfo.api.choosing.php

Related

Can’t Run Pydio Locally

The company where I work at has a slightly modified backoffice done in Pydio 8.0.1 up and running in the server.
Thing is I want to run it locally in Xampp to test if it works well alongside the new website I made for the company.
My problem is that I can’t get it running locally even though I have the database running in PHP MyAdmin. The errors that I get are:
Deprecated : Function create_function() is deprecated in C:\xampp\htdocs\backoffice2\core\src\lib\dibi\libs\DibiConnection.php on line 120
Fatal error : Uncaught Pydio\Core\Exception\PydioException: Severe error while loading plugins registry : There was an error trying to connect to your database! Did you change any configuration for the core connection? Or maybe your database is down? in C:\xampp\htdocs\backoffice2\core\src\pydio\Core\PluginFramework\PluginsService.php:819 Stack trace: #0 C:\xampp\htdocs\backoffice2\core\src\pydio\Core\PluginFramework\PluginsService.php(203): Pydio\Core\PluginFramework\PluginsService->getDetectedPlugins() #1 C:\xampp\htdocs\backoffice2\core\src\pydio\Core\Services\ConfService.php(392): Pydio\Core\PluginFramework\PluginsService::getInstance(Object(Pydio\Core\Model\Context)) #2 C:\xampp\htdocs\backoffice2\core\src\pydio\Core\Http\Base.php(62): Pydio\Core\Services\ConfService::getGlobalConf(‘ADMIN_URI’) #3 [internal function]: Pydio\Core\Http\Base::handleRoute(’/backoffice2’, ‘/’, Array) #4 C:\xampp\htdocs\backoffice2\core\src\pydio\Core\Http\TopLevelRouter.php(139): call_user_func(Array, ‘/backoffice2’, ‘/’, Array) #5 C:\xamp in C:\xampp\htdocs\backoffice2\core\src\pydio\Core\PluginFramework\PluginsService.php on line 819
By the Way I noticed that the “Bootstrap.json” has the following custom lines:
“AJXP_CLI_SECRET_KEY”:“vkkhh$lskdNyoNpi$B4Gc5DN”,
“DIBI_PRECONFIGURATION”:{
“mysql_username”:“hardlevel_pt”,
“mysql_use_mysqli”:“true”,
“mysql_password”:“ubukN4g8”,
“mysql_host”:“hardlevel.pt.mysql”,
“mysql_driver”:“mysql”,
“mysql_database”:“hardlevel_pt”,
“group_switch_value”:“mysql”
}
Can anyone give me some insight on this situation? Any help is greatly apreciated.
Maybe it's problem of php version on Pydio 8.0.1
Try to upgrade to latest version of Pydio if you are using PHP 7.2

Wordpress Fatal error after migrating from php5.6 to php7 [duplicate]

This question already has an answer here:
"Call to undefined function mysql_connect()" after upgrade to php-7 [duplicate]
(1 answer)
Closed 5 years ago.
My WP site is currently on php 5.6, but when updated to PHP7, I get the following fatal message and the white screen of death.
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/s7280o8m/public_html/wp-includes/wp-db.php:1568 Stack trace: #0 /home/s7280o8m/public_html/wp-includes/wp-db.php(658): wpdb->db_connect() #1 /home/s7280o8m/public_html/wp-includes/load.php(404): wpdb->__construct('s7280o8m_wp891', 'K(p64#S137', 's7280o8m_wp891', 'localhost') #2 /home/s7280o8m/public_html/wp-settings.php(106): require_wp_db() #3 /home/s7280o8m/public_html/wp-config.php(90): require_once('/home/s7280o8m/...') #4 /home/s7280o8m/public_html/wp-load.php(37): require_once('/home/s7280o8m/...') #5 /home/s7280o8m/public_html/wp-blog-header.php(13): require_once('/home/s7280o8m/...') #6 /home/s7280o8m/public_html/index.php(17): require('/home/s7280o8m/...') #7 {main} thrown in /home/s7280o8m/public_html/wp-includes/wp-db.php on line 1568
F.Y.I :
Ran the PHP7 compatibly test and the plugins + theme were all good.
In trying solve the fatal error, I have deactivated all the plugins (one by one) and then re-activate (one by one), plus changed the theme, but the problem still persists.
Really would appreciate any help on this.
You seem to be using pretty ancient installation of your Wordpress as mysql extension was deprecated for a long time and is removed from PHP7 completely. New code uses mysqli (directly or via PDO), you need to upgrade your Wordpress to recent codebase. Or downgrade PHP.
Are you sure that you are running the latest version of WordPress? (at the time of writing the current version is 4.8.1, you can download it from this page: https://wordpress.org/download/)
It looks like you're running an outdated version because it refers to the mysql_connect function which has been deprecated in PHP 5.5.0 and totally removed in PHP 7.0 (as you can see here).
Also check for any plug-in installed which may be outdated: rename the plugins directory inside of wp-content if you want to disable every plugin at once.

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

PHP connect to MS Access database - Provider not found

I know there are tons of questions about this on SO. But I've been trying to fix this since a month with no luck.
At work we have this very old website that uses an access database, and I cannot do anything about it.I want to work on some changes on my local PC using wamp server. So I donwloaded the website along with the db. Here is how it's supposed to connect :
$conn = new COM('ADODB.Connection');
$db = realpath("dbalerts.mdb");
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
But it's giving me this error:
Fatal error: Uncaught exception 'com_exception' with message 'Source: ADODB.Connection
Description:Provider cannot be found. It may not be properly installed.'
in C:\wamp\www\testaccess\index.php:5 Stack trace: #0 C:\wamp\www\testaccess\index.php(5): com->Open('Provider=Micros...') #1 {main} thrown in C:\wamp\www\testaccess\index.php on line 5
It's a test folder whith an index.php where only that code is written. In the same folder is dbalerts.mdb
I tried everything I know. I downloaded AccessDatabaseEngine.exe from MS website which is supposed to have the driver. And it installed properly with no errors( had to uninstall office because it was 64bit)
I am on a win8 machine
Any ideas how I can fix this all while still using COM and ADODB? Because I can't go through changing the connections of every .php file in that website (it's old and poorly designed so not adaptable to changes)

MAMP Localhost not working (Error 500) - LWT

I am trying to run LWT on my mac and have installed MAMP for this. I have followed these instructions, but when I try to go to http://localhost:8888/lwt/ I am getting:
The localhost page isn’t working
localhost is currently unable to handle this request.
500
I have created a different folder in my htdocs folder and created a php file in it (index.php), with some code to see if php is working:
<?php
echo "this is the start";
phpinfo();
echo "<br>this is the end";
?>
That is all fine and works. I have also checked the user-rights for the lwt folder, but it seems fine too (Admins & Me are Read&Write, Others are ReadOnly). Typing tail -f /Applications/MAMP/logs/php_error.log into the terminal gives me the following error log:
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /Applications/MAMP/htdocs/lwt/utilities.inc.php:3272
Stack trace:
#0 /Applications/MAMP/htdocs/lwt/index.php(46): require_once()
#1 {main}
thrown in /Applications/MAMP/htdocs/lwt/utilities.inc.php on line 3272
I am a beginner though, so I don't know what else the problem could be. Any ideas?
I don't know which version of PHP you use. But the mysql_* function are deprecated and its possible that its not included in your new version anymore. Use mysqli_* to connect to your database or use PDO.
In the new version of MAMP is PHP7 included. Perhaps you use that.

Categories