Hi,
I was trying to install Classicpress 1.5.0 on my server with PHP 5.6 and Mysql 5.5 I am getting DB connection error on filling the Database details.The details are correct and I have tested it with a test file. The classicpress installer is unable to connect to the DB and failed to write to the wp-config.php file.
Error establishing a database connection
This either means that the username and password information in your wp-config.php
file is incorrect or we can’t contact the database server at localhost
. This could mean your host’s database server is down.
** Are you sure you have the correct username and password?*
** Are you sure that you have typed the correct hostname?*
** Are you sure that the database server is running?*
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the ClassicPress Support Forums .
Expected behavior
Database connection should be made and details should filled in config file.
Current behavior
Error establishing a database connection
Steps to reproduce
Extract the zip
Give the desired permission
Run the installer and fill the Database details.
Save the details and it throws error.
viktor
January 6, 2023, 1:22pm
2
Hi, have you checked if your PHP includes mysql extension and it’s enabled?
This is happening to me also.
A bit of context:
Plesk panel (so CP manual install)
upload and unzip the files to the correct folder (it sets permissions by default)
create DB and user for DB and keep all credentials handy to put in the installer
run installer, write database credentials, and such
INSTALLER STALLS (with the same message as the OP).
Tried:
install everything from scratch several times, with no luck.
manually editing wp-config with database credentials. again with no luck, it says it already has a wp-config file and to continue installing if I want to use it then stalls with an error message again about not being able to connect to the database.
To be noted, previous versions of ClassicPress on Plesk did install smoothly as butter. Might it be Plesk messing up things? I noticed my host has WP-CLI and Composer folders (so it supports the use of WP-CLI and Composer I think?), are these of some use to install CP another way to see if I am able to have it done?
Thanks for any advice you can give to shed light on this…
Edited to add: I am using PHP 8 since my host supports it and has recently updated to it.
@jameswill maybe I found the solution because now it works for me.
Steps to correctly install manually (without installers like softaculous)
create a database and user for the database, keep credentials handy
upload files to the correct location
edit wp-config-sample.php with DBASE CREDENTIALS and SALTS VALUES (the given link to generate them will create the SALTS, you need to copy them and paste them in place of the empty ones under the part where you inserted the database credentials. You can also generate them in one of the ways explained on the page that generates them for a more secure install).
save the file and run the installer visiting the domain.
fill in database credentials and after that, it will ask for site identity and user data proceeding with the installation as expected.
Being that I do not usually install CP manually very often I forgot the SALTS step, and that is why it wasn’t making a database connection for me.
viktor
January 10, 2023, 1:32pm
5
The issue has been identified:
opened 12:56PM - 10 Jan 23 UTC
closed 04:02PM - 31 Jan 23 UTC
type: bug
status: needs triage
### Expected behavior
Compatibility with PHP 5.6.
Installation without error… s on PHP 5.6.
### Current behavior
This is the output of `phpcs --standard=PHPCompatibility --runtime-set testVersion 5.6`:
```
FILE: src/wp-includes/PHPMailer/PHPMailer.php
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
2776 | ERROR | The function random_bytes() is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------
FILE: src/wp-includes/SimplePie/Locator.php
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
88 | ERROR | The built-in interface Throwable is not present in PHP version 5.6 or earlier
--------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_bytes_libsodium.php
---------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
49 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
55 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
---------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_bytes_mcrypt.php
------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------
47 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
54 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_bytes_dev_urandom.php
-----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------
111 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
112 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
118 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/byte_safe_strings.php
-----------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------
50 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
73 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
106 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
112 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
125 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
164 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
170 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
177 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_bytes_libsodium_legacy.php
----------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------
48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
49 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
55 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_bytes_com_dotnet.php
----------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------
46 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
47 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
53 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
61 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/cast_to_int.php
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
71 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/random_int.php
-----------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
-----------------------------------------------------------------------------------------
56 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
57 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
65 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
66 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
77 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
169 | ERROR | The function random_bytes() is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------
FILE: src/wp-includes/random_compat/error_polyfill.php
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
39 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
-------------------------------------------------------------------------------------
FILE: src/wp-includes/wp-db.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 48 WARNINGS AFFECTING 24 LINES
-------------------------------------------------------------------------------------
796 | WARNING | Function mysql_set_charset() is deprecated since PHP 5.5
796 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
803 | WARNING | Function mysql_query() is deprecated since PHP 5.5
803 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
824 | WARNING | Function mysql_query() is deprecated since PHP 5.5
824 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
838 | WARNING | Function mysql_result() is deprecated since PHP 5.5
838 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
870 | WARNING | Function mysql_query() is deprecated since PHP 5.5
870 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1073 | WARNING | Function mysql_select_db() is deprecated since PHP 5.5
1073 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1156 | WARNING | Function mysql_real_escape_string() is deprecated since PHP 5.5
1156 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1425 | WARNING | Function mysql_error() is deprecated since PHP 5.5
1425 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1563 | WARNING | Function mysql_free_result() is deprecated since PHP 5.5
1563 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1652 | WARNING | Function mysql_connect() is deprecated since PHP 5.5
1652 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1655 | WARNING | Function mysql_connect() is deprecated since PHP 5.5
1655 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1785 | WARNING | Function mysql_ping() is deprecated since PHP 5.5
1785 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1924 | WARNING | Function mysql_errno() is deprecated since PHP 5.5
1924 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1949 | WARNING | Function mysql_error() is deprecated since PHP 5.5
1949 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1971 | WARNING | Function mysql_affected_rows() is deprecated since PHP 5.5
1971 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1978 | WARNING | Function mysql_insert_id() is deprecated since PHP 5.5
1978 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
1991 | WARNING | Function mysql_fetch_object() is deprecated since PHP 5.5
1991 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
2023 | WARNING | Function mysql_query() is deprecated since PHP 5.5
2023 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3089 | WARNING | Function mysql_client_encoding() is deprecated since PHP 5.5
3089 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3305 | WARNING | Function mysql_num_fields() is deprecated since PHP 5.5
3305 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3307 | WARNING | Function mysql_fetch_field() is deprecated since PHP 5.5
3307 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3402 | WARNING | Function mysql_close() is deprecated since PHP 5.5
3402 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3501 | WARNING | Function mysql_get_client_info() is deprecated since PHP 5.5
3501 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
3557 | WARNING | Function mysql_get_server_info() is deprecated since PHP 5.5
3557 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
-------------------------------------------------------------------------------------
FILE: src/wp-includes/pluggable.php
---------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------
2447 | ERROR | The function random_int() is not present in PHP version 5.6 or earlier
2453 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
---------------------------------------------------------------------------------------
FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------
962 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
971 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
----------------------------------------------------------------------------------------------------------
FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
--------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------
452 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
455 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
--------------------------------------------------------------------------------------------------------------
FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------
910 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
914 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
-------------------------------------------------------------------------------------------------------------
FILE: src/wp-includes/rest-api/class-wp-rest-server.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------
1298 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
1301 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
1302 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
1305 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
-------------------------------------------------------------------------------------------------------------
FILE: src/wp-admin/includes/upgrade.php
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
2773 | ERROR | The function str_contains() is not present in PHP version 7.4 or earlier
-----------------------------------------------------------------------------------------
FILE: src/wp-admin/setup-config.php
--------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------
303 | ERROR | The function random_int() is not present in PHP version 5.6 or earlier
--------------------------------------------------------------------------------------
FILE: src/xmlrpc.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------
20 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
21 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
25 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
26 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
26 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
-----------------------------------------------------------------------------------------------------------
```
### ClassicPress version
1.5.0 and prior
### PHP version
5.6
1 Like