Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
what is the problem with new php 4.4.2 version?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Wed May 10, 2006 2:52 pm    Post subject: what is the problem with new php 4.4.2 version? Reply with quote

I have updated my php version into the new one due to the latest security issues with the following command;
Quote:
emerge --ask --verbose =dev-lang/php-4.4.2-r2


After upgrade, my turkish characters fetched from mysql are not displayed properly. I have updated php.ini too. I have looked at php 4.4.2 changelog but I havent seen anything related to this issue. Do you have any idea what can cause this encoding problem?
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Wed May 10, 2006 3:43 pm    Post subject: Reply with quote

Only changes regarding charsets in the new PHP ebuilds were that:
a) the mbstring extension is now activated through the "unicode" USE flag
b) PHP now reads /etc/mysql/my.cnf to get the default charset for MySQL connections, it reads the [client] section of that file by default, so just set there what you want to be used, normally latin1 or utf8, you could even add a PHP-specific section, like [php-cgi-fcgi] for php-cgi, or [php-cli] for the php CLI interpreter, for mod_php it should be [apache2handler], but I'm not 100% sure what the SAPI name is for that one. :)
Hope this helps.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
Pointer
n00b
n00b


Joined: 10 Sep 2003
Posts: 16

PostPosted: Wed May 10, 2006 5:04 pm    Post subject: Reply with quote

I have the same problem, so please tell if you find a solution!

--
Henri
Back to top
View user's profile Send private message
intuiworx
n00b
n00b


Joined: 10 May 2006
Posts: 1

PostPosted: Wed May 10, 2006 7:10 pm    Post subject: Reply with quote

I had the same trouble when I upgraded to php-4.4.2-r2 as well. In my case, I had Unicode enabled in packages.use for PHP4 and PHP5, but php-4.4.2-r2 still compiled without it. Try enabling it in your make.conf as well; that did the trick for me.

I'm not entirely sure if this is intended (ie, you can't/shouldn't compile PHP w/o unicode being enabled on a system-wide level) or not ... if someone can confirm it isn't, I'll file a bug report.
Back to top
View user's profile Send private message
Pointer
n00b
n00b


Joined: 10 Sep 2003
Posts: 16

PostPosted: Wed May 10, 2006 9:03 pm    Post subject: Reply with quote

In a my server unicode flag has always been set on in /etc/make.conf.
What I did was compiled mysql-5 with latin1 flag set on.

Now charsets are working ok, phpBB, mediawiki etc..

--
Henri
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Thu May 11, 2006 7:02 am    Post subject: Reply with quote

Hello,
We had already lots of problems when we migrated into 4.1.x mysql version due to charset. if we set charset in latin5 which is for Turkish, we cannot see characters properly. When we set latin1 we can see chars without any problem but now php looks at the my.cnf file, even if I set latin5 or utf8 in [client] section I cannot see my characters in their proper view. I dont know what to do. I would like to upgrade due to security bugs, but I cannot do it. I have compiled with unicode support but nothing changed. Is there any way to force php not to look at my.cnf and behave as it did ?

Thanks a lot.
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Thu May 11, 2006 7:18 am    Post subject: Reply with quote

PHP "before" used latin1 as charset, so turing only PHP back to that should fix your problems...
If you use mod_php, adding the following to my.cnf should help:

Code:

[apache2handler]
default-character-set=latin1


This assuming you're using Apache2. Running a phpinfo() will anyway give you the exact name of the SAPI.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Thu May 11, 2006 7:41 am    Post subject: Reply with quote

I have written those apache2handler section into my.cf but nothing changed.
php is compiled as a module in apache. Below is my apache2handler text in my phpinfo.
I hope we will find a solution to this problem. Nothing changes anything.

Quote:
apache2handler
Apache Version Apache
Apache API Version 20020903
Server Administrator sistem@xxx
Hostname:Port xxx:0
User/Group apache(81)/81
Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100
Timeouts Connection: 30 - Keep-Alive: 4
Virtual Server Yes
Server Root /usr/lib/apache2
Loaded Modules core prefork http_core mod_so mod_access mod_auth mod_auth_anon mod_auth_dbm mod_auth_digest mod_charset_lite mod_env mod_expires mod_headers mod_mime mod_negotiation mod_setenvif mod_log_config mod_logio mod_alias mod_rewrite mod_actions mod_dir mod_ext_filter mod_deflate mod_include sapi_apache2
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Thu May 11, 2006 10:41 am    Post subject: Reply with quote

Hmm could you try to execute the PHP script found at https://forums.gentoo.org/viewtopic-p-3256496.html#3256496 and post the output? Thanks.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Thu May 11, 2006 10:50 am    Post subject: Reply with quote

Here is the output
Quote:
The current character set is: latin1 Get the charset data: character_set_client -_-_- latin1 character_set_connection -_-_- latin1 character_set_database -_-_- latin1 character_set_results -_-_- latin1 character_set_server -_-_- latin1 character_set_system -_-_- utf8 character_sets_dir -_-_- /usr/share/mysql/charsets Get the collation data: collation_connection -_-_- latin1_swedish_ci collation_database -_-_- latin1_swedish_ci collation_server -_-_- latin1_swedish_ci


This output is from the previous version of php. I have removed the new version and the old version is running now.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Thu May 11, 2006 10:59 am    Post subject: Reply with quote

By the way, I am using mysql 4.1.19 version.
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Thu May 11, 2006 2:06 pm    Post subject: Reply with quote

That output looks correct to me? I mean, before PHP was latin1, here it also says all "latin1", so it's like before... Did you emerge mysql-4.1.19 with the "latin1" USE flag on? What did you have previously (with older mysql versions), the "utf8" flag enabled, or no charset-related flag enabled at all? What does your /etc/mysql/my.cnf look like?
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Thu May 11, 2006 2:45 pm    Post subject: Reply with quote

I cant tell you my feelings CHTEKK, I must thank you a lot. Because I didnt set any flag for latin char set previosly I had looked at my use flags and latin1 was disabled. I have enabled and re-emerged mysql and after a restart apache new php worked properly. Many many thanks for your support.

Regards.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Fri May 12, 2006 1:31 pm    Post subject: Reply with quote

Hello,
I had tested previous setup in my test server and it worked properly. Now I have installed mysql 4.1.19 into my production system and set my.cf as below;

Quote:
[apache2handler]
default-character-set=latin1

[client]
#password = your_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=latin1

[mysql]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqladmin]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlcheck]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqldump]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlimport]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlshow]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[myisamchk]
character-sets-dir=/usr/share/mysql/charsets

[myisampack]
character-sets-dir=/usr/share/mysql/charsets

# use [safe_mysqld] with mysql-3
[mysqld_safe]
err-log = /var/log/mysql/mysql.err
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
[mysqld]
character-sets-dir=/usr/share/mysql/charsets
character-set-server = latin1
default-character-set = latin1


I have installed php with the following on the web server;
Quote:
tux php # emerge -av =dev-lang/php-4.4.2-r2

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild R ] dev-lang/php-4.4.2-r2 -adabas -apache +apache2 +bcmath +berkdb -birdstep +bzip2 -calendar -cdb -cgi -cjk +cli +crypt -ctype -curl -db2 -dbase -dbmaker -dbx -debug -discard-path -doc -empress -empress-bcs -esoob -exif +expat -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase +ftp +gd -gd-external -gdbm -gmp +hardenedphp -hyperwave-api +iconv -imap -informix -inifile -interbase -iodbc -ipv6 -java-external -java-internal -kerberos -ldap -libedit -mcal -mcve -memlimit +mhash -ming -mnogosearch -msql -mssql+mysql +ncurses +nls -oci8 -oci8-instant-client -odbc -oracle7 -overload -ovrimos -pcntl +pcre -pfpro -pic -posix -postgres +readline -recode -sapdb +session -sharedext -sharedmem -snmp -sockets -solid +spell -sqlite -ssl -sybase -sybase-ct -sysvipc -threads -tokenizer +truetype -unicode -wddx +xml +xmlrpc -xpm -xsl -yaz -zip +zlib 0 kB


Web server connects into the db server through TCP when I get the charset variables with this new php installation I got the following;

Quote:
The current character set is: utf8
Get the charset data: character_set_client -_-_- utf8
character_set_connection -_-_- utf8
character_set_database -_-_- latin1
character_set_results -_-_- utf8
character_set_server -_-_- latin1
character_set_system -_-_- utf8
character_sets_dir -_-_- /usr/share/mysql/charsets
Get the collation data: collation_connection -_-_- utf8_general_ci collation_database -_-_- latin1_swedish_ci collation_server -_-_- latin1_swedish_ci


Here is the output of character set in my DB server.
Quote:
mysql> show variables like '%character%';
+--------------------------+---------------------------+
| Variable_name | Value |
+--------------------------+---------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets |
+--------------------------+---------------------------+


MySQL is compiled with the following USE flags.

Quote:
db1 mysql # emerge -av mysql

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild R ] dev-db/mysql-4.1.19 -berkdb -big-tables -cluster -debug -embedded -extraengine +latin1 -minimal +perl -raid (-selinux) -srvdir -ssl -static 0 kB



I hope I can explain my problem. Even if charset is latin1 on the DB server and I have set the variables in my.cf but php still see utf8 charset.

Do you have any idea for this problem?

PS: I have compiled PHP with unicode but it didnt work either.
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Fri May 12, 2006 3:47 pm    Post subject: Reply with quote

Ok your DB server is obviously ok, so the problem in this case is PHP, and I also know why: it's not [apache2handler] in my.cnf, but [php-apache2handler], I'm really sorry for the mistake, I was convinced the name was only apache2handler and only realized now doing some testing with mod_php especially that there was a php- before it too, sorry. :) That should fix your problems. ;)
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
pointers
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2004
Posts: 123

PostPosted: Mon May 15, 2006 8:02 pm    Post subject: Reply with quote

Hello Chtekk,
I have tested with the new config which contains;
Quote:
[php-apache2handler]
default-character-set=latin1


but nothing changed. I am really shocked. My first server is running properly with exactly the same software. mysql 4.1.19 and php-4.4.2-r2 . The only difference (as far as I see, If I am not mistaken in any part) my production server connects into the DB server through tcp. Test server uses domain socket. Php installations have unicode support.
In fact there are two webserver using the same DB server. One server has the old php and the other one has the new compiled php. The old one sees latin1 when I execute your file, new one insists on seeing utf8 . I cannot change it and I have tried all the possibilities. (I think so)
Is there any config in php.ini which can cause this problem? I use apache in a jail environment and I copy php module and dependencies into the jail at every update. (with the ebuild that I have written) but test server is also running in a jailed apache environment but it works.
Due to this problem, I cannot upgrade my php into the secure one. If anything comes into your mind, I really would like to hear it.

Regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum