Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Found a bug? Tell us!!
Post Reply
orang
Regular
Posts: 23
Joined: Wed Aug 16, 2006 9:03 am

Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by orang »

Dear S9y people,

I have been running a blog on our website since a long time without any problems, and now, out of the blue, I get this error message when trying to access either the front end or the back end:

Warning: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE' (this will throw an Error in a future version of PHP) in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_config.inc.php on line 165 Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php:270 Stack trace: #0 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_config.inc.php(264): serendipity_db_connect() #1 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/index.php(26): include('/customers/d/f/...') #2 {main} thrown in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php on line 270


Anybody knows how to fix this? What this actually refers to? I'm actually not entirely sure, which PHP version we are currently using, i.e. that's running on the host server.


Thank you,
Stefan
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by yellowled »

orang wrote: Tue Nov 27, 2018 6:02 pm I'm actually not entirely sure, which PHP version we are currently using, i.e. that's running on the host server.
Please find out. Also, please state the s9y version you're using.

I think this has been addressed recently, but there's no release yet to fix it.

YL
orang
Regular
Posts: 23
Joined: Wed Aug 16, 2006 9:03 am

Re: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by orang »

Thank you, I actually missed your comment all this time. I fixed the undefined CHARSET problem, but I don't really get how to fix the mysql problem I mentioned and I'm no entirely sure, if this is the same mentioned in the thread you referred to. Do you have any hints how to fix that?

Right now, I actually don't know exactly which Serendipity version is used, but I know that it is very old. It's a website I manage very rarely and one that is hardly used. So, the installer.inc.php file is from 2009, that makes it almost 10 years old...
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by yellowled »

I don't really see a way to help you without even knowing the s9y or PHP version, but if it is indeed from 2009, you should update to a current release as soon as possible because this version does have multiple security issues by now. Please note that the current version of s9y does not yet support PHP 7.2, so make sure to use 7.1.

YL
orang
Regular
Posts: 23
Joined: Wed Aug 16, 2006 9:03 am

Re: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by orang »

How can I find out which s9y version is installed, if I cannot access the admin area? Because of this error, I can neither access front end nor back end.

The PHP version is indeed 7.2. I changed it to version 7.1, but this error is still occurring:

Code: Select all

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php:270 Stack trace: #0 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_config.inc.php(264): serendipity_db_connect() #1 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_admin.php(9): include('/customers/d/f/...') #2 {main} thrown in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php on line 270
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by yellowled »

orang wrote: Sat Jan 12, 2019 3:07 pm How can I find out which s9y version is installed, if I cannot access the admin area?
Assuming that you have always updated all the files, docs/RELEASE should give you the version number (stable).
orang wrote: Sat Jan 12, 2019 3:07 pm

Code: Select all

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php:270 Stack trace: #0 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_config.inc.php(264): serendipity_db_connect() #1 /customers/d/f/6/weisenbacher.de/httpd.www/kfd/serendipity_admin.php(9): include('/customers/d/f/...') #2 {main} thrown in /customers/d/f/6/weisenbacher.de/httpd.www/kfd/include/db/mysql.inc.php on line 270
mysql_connect() is a PHP function to connect to a MySQL database, but it has been deprecated and removed in PHP7 entirely.

I'm not really a PHP coder, but I would assume the following:

* You're running a rather old s9y version which that still uses mysql_connect().
* Newer versions of s9y would check for this and work around it (I can't explain how).
* Your hoster upgraded to PHP7, thus removing mysql_connect().
* Since your s9y was not up-to-date, it's now unable to connect to your database.

I would first check the currently installed s9y version, but I assume you'll have to update your s9y and then it should be able to connect to the database again. However, please make backups of your s9y installation and the database before your attempt to update!

YL
Post Reply