PHP5 + Mysql 5 Türkçe Karakter Problemi
2005-12-22 11:15:43
PHP5 + MYSQL 5 ikilisinin kurulu olduğu bir sunucuda şu şekilde bir sorun ile karşılaşmıştım. Bu problemi linux listelerindeki arkadaşlara da sordum ve saolsunlar yardımcı oldular. Bende şimdi sizlerle paylaşmak istedim.
Site üzerinden mysql 'den veri çeken php dosyasını çağırdığımda Türkçe karakterler ? şeklinde gözüküyordu. Bunun bir çok nedeni olabilirdi başlangıçta. Mysql 'i latin5 charset ile başlatmak sorunu çözebilirdi ama yetmedi. Daha sonra bu problemin mysql in bir bug 'ı olduğunu ve mysql i çalıştırırken verilen bir parametre ile bunun düzeltilebildiğini öğrendim. Doğruymuş:)

/etc/my.cnf dosyamı şu şekilde düzenledim:

[root@~~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
default-character-set=latin5
#character-sets-dir=/usr/share/mysql/charsets
#default-collation=latin5_turkish_ci
max_connections = 400

[mysql.server]
user=mysql
default-character-set=latin5

[safe_mysqld]
err-log=/var/log/mysqld.log

[mysql]
default-character-set=latin5

ve bu conf. dosyasına ek olarak mysql sürecini başlatan betiğe aşağıdaki parametre yi de ekliyorsunuz.

--skip-character-set-client-handshake

Bu parametre, varsayılan server karakter setini kullanan ve clientlar tarafından gönderilen karakter set bilgisini yok sayar.

Doubtlessly you will be familiar with tools such as ISO Buster for Windows which allow you to open an ISO file without having to burn it to CD to have a little lookie at its contents….However, in Linux we have this tech built in. And ISO image can be mounted just like any device or file system, and here is how…

Create a mount point for the ISO:

BASH# mkdir /mnt/iso

Now mount the ISO in the mount point with the following command:

BASH# mount myiso.iso /mnt/iso/ -t iso9660 -o ro,loop=/dev/loop0

Where myiso.iso is your ISO file.

What I haven’t tried yet is omitting the ro (read only) option, so that it might be possible to make changes to the ISO before finally burning, not sure if this works (will check) but the command would probably look like this:

BASH# mount myiso.iso /mnt/iso/ -t iso9660 -o loop=/dev/loop0

linux konsolda Birden cok dosya icinde bul ve degistir islemleri yapmak.

Bu kod yeni sunuculardan bir tanesine aktarilan domainlerin dnslerinde yapilmasi gereken degisikler icin gerekti.

Basariyla uygulandi.

ingilizce metin su sekilde:


You could also use find and sed, but I find that this little line of perl works nicely.
perl -pi -w -e 's/search/replace/g;' *.php
-e means execute the following line of code.
-i means edit in-place
-w write warnings
-p loop

Example I had the following style sheet in a section:
and I wanted the following instead:
As each expression is a regular expression you’ve got to escape the special characters such as forward slash and .
\.\.\/includes\/style\.css

So the final line of code ends up as
perl -pi -w -e ‘s/\.\.\/includes\/style\.css/admin\.css/g;’ *.php

Benim uguladigim sekilde ise :

/var/named/*.db dosyalarinda
ns1.eskidomain.net.
adresinin

ns1.yenidomain.org.
ile degistirilmesi gerek


[root@pbserver named]# perl -pi -w -e 's/ns1\.eskidomain\.net\./ns1\.yenidomain\.org\./g;' *.db
[root@pbserver named]# perl -pi -w -e 's/ns2\.eskidomain\.net\./ns2\.yenidomain\.org\./g;' *.db

 

000000000000000000000000000000000

EK 1 KASIM 2017

=================================

find and replace etmenin yolu daha degisik sekilde

for E in `cat aaa.txt`; do perl -pi -w -e 's/content type/content_type/g;' $E; done