Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

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

Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE'

Post by orang » Tue Nov 27, 2018 7:02 pm

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

User avatar
yellowled
Regular
Posts: 7020
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

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

Post by yellowled » Tue Nov 27, 2018 9:13 pm

orang wrote:
Tue Nov 27, 2018 7: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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

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

Post by orang » Fri Jan 11, 2019 2:46 pm

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...

User avatar
yellowled
Regular
Posts: 7020
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

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

Post by yellowled » Fri Jan 11, 2019 9:56 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

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

Post by orang » Sat Jan 12, 2019 4:07 pm

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

User avatar
yellowled
Regular
Posts: 7020
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

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

Post by yellowled » Sat Jan 12, 2019 4:52 pm

orang wrote:
Sat Jan 12, 2019 4: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 4: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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply