Solution to the problem that phpcms cannot connect to the server: First find and open the "install/step5.tpl.php" file; then modify the code to "var dbpw = 'var dbpw = escape(''); ';" and save the file.
New installation of phpcms v9 prompts that it cannot connect to the database server
Cause: The database password is a special character.
When installing phpcms, it appears that the database server cannot be connected. Please check the configuration, but the database information is completely correct.
I searched a lot on the Internet but could not solve the problem. Later I found out that it was the database password. There are two ways to solve this problem if there are special characters "such as: !@#".
The first is to change the database password, but this is not particularly good, right,
The second Two methods: modify two places in total
1. Modify line 127 of install/step5.tpl.php
Replace:
var url = '?step=dbtest&dbhost='+$('#dbhost').val()+'&dbuser='+$('#dbuser').val()+'&dbpw='+$('#dbpw').val()+'&dbname='+$('#dbname').val()+'&tablepre='+$('#tablepre').val()+'&sid='+Math.random()*5;
with:
var url = '?step=dbtest&dbhost='+$('#dbhost').val()+'&dbuser='+$('#dbuser').val()+'&dbpw='+'&dbpw='+escape($('#dbpw').val())+'&dbname='+$('#dbname').val()+'&tablepre='+$('#tablepre').val()+'&sid='+Math.random()*5;2.修改install/step6.tpl.php 55行
Replace:
var dbpw = '<?php echo $dbpw?>';
with:
var dbpw = 'var dbpw = escape('<?=$dbpw?>');';
Recommended: "phpcms tutorial"
The above is the detailed content of What should I do if phpcms cannot connect to the data server?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!
