Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Carcleo

utf8 - Diferença entre localhost e servidor remoto

Recommended Posts

Ola.;

 

Tenho uma duvida com utf8

 

No meu servidor local (localhost), quando vou exibir uma variael que recebne valor dor banco que contenho um valor como por exemplo o til (São), ele exibe o til como valor assim: (São).

 

Acontece que no meu servidor remoto (internet) ele exibe esse mesmo valor normal.

 

Isso é alguma configuração do php.ini?

Qual?

 

Detalhe: no banco esta assim: São Francisco

 

Localhost Exibe : São Francisco

Host Hospedagem Exibe : São Francisco

 

utf8 - Diferença entre localhost e servidor remoto

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom, no meu php.ini, essa linha default_charset = "iso-8859-1", esta comentada. Tirei o comentario, reiniciei o Apache e não resolveu.

 

E no Arquivo de confirgurações do Apache (httpd.conf)não tem essa linha AddDefaultCharset utf-8.

 

No caso, tenho que alterar nos dois (php.ini e httpd.conf) ou só em uim, dos dois?

 

Meu php é 5.3.1

Meu Apache é 2.2.14

Compartilhar este post


Link para o post
Compartilhar em outros sites

se adicionar os dois, dá conflito de charset.

 

postei os valores padrão para q você verificasse.

 

veja também no servidor como está

 

e veja no servidor o charset e collation default's do BD

 

não se esqueça de utilizar headers e identificadores de charset para forçar o documento a ser exibido no formato que você deseja

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ola

No head das minhas paginas já carrega o charset como utf-8

 

Mas, você conseguiu entender?

 

Estou carregando o form assim:

<TR>
					  <TD>BAIRRO</TD>
					  <TD><INPUT Type='text' NAME='TBAIRRO' value='$bairro'></TD>
				  </TR>
No localhost pede para colocar a função utf8 assim:

<TR>
					  <TD>BAIRRO</TD>
					  <TD><INPUT Type='text' NAME='TBAIRRO' value='".utf8_decode($bairro)."'></TD>
				  </TR>
Mas la no servbidor de hospedagem não pede. Em outras palavras,. não precisa colocar.

 

Tendeu mais ou menos?

Segue php.ini do servidor (php_info();):

O meu é 5.3.1

PHP Version 5.2.11 

System  Linux rg.insite.com.br 2.6.9-89.0.19.ELsmp #1 SMP Fri Jan 8 06:32:22 EST 2010 i686  
Build Date  Sep 24 2009 00:03:02  
Configure Command  './configure' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-fastcgi' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-maintainer-zts' '--enable-mbstring' '--enable-sockets' '--enable-sqlite-utf8' '--enable-zip' '--prefix=/usr' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mime-magic' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pgsql=/usr' '--with-png-dir=/usr' '--with-ttf' '--with-xmlrpc' '--with-xpm-dir=/usr/X11R6' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr'  
Server API  CGI/FastCGI  
Virtual Directory Support  enabled  
Configuration File (php.ini) Path  /usr/lib  
Loaded Configuration File  /home/nature/public_html/php.ini  
Scan this dir for additional .ini files  (none)  
additional .ini files parsed  (none)  
PHP API  20041225  
PHP Extension  20060613  
Zend Extension  220060519  
Debug Build  no  
Thread Safety  enabled  
Zend Memory Manager  enabled  
IPv6 Support  enabled  
Registered PHP Streams  https, ftps, compress.zlib, php, file, data, http, ftp, zip  
Registered Stream Socket Transports  tcp, udp, unix, udg, ssl, sslv3, sslv2, tls  
Registered Stream Filters  zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed  

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
 


--------------------------------------------------------------------------------

PHP Credits

--------------------------------------------------------------------------------

Configuration
PHP Core
Directive Local Value Master Value 
allow_call_time_pass_reference On On 
allow_url_fopen On On 
allow_url_include Off Off 
always_populate_raw_post_data Off Off 
arg_separator.input & & 
arg_separator.output & & 
asp_tags Off Off 
auto_append_file no value no value 
auto_globals_jit On On 
auto_prepend_file no value no value 
browscap no value no value 
default_charset no value no value 
default_mimetype text/html text/html 
define_syslog_variables Off Off 
disable_classes no value no value 
disable_functions no value no value 
display_errors On On 
display_startup_errors Off Off 
doc_root no value no value 
docref_ext no value no value 
docref_root no value no value 
enable_dl On On 
error_append_string no value no value 
error_log no value no value 
error_prepend_string no value no value 
error_reporting no value no value 
expose_php On On 
extension_dir /usr/lib/php/extensions/no-debug-zts-20060613 /usr/lib/php/extensions/no-debug-zts-20060613 
file_uploads On On 
highlight.bg #FFFFFF #FFFFFF 
highlight.comment #FF8000 #FF8000 
highlight.default #0000BB #0000BB 
highlight.html #000000 #000000 
highlight.keyword #007700 #007700 
highlight.string #DD0000 #DD0000 
html_errors On On 
ignore_repeated_errors Off Off 
ignore_repeated_source Off Off 
ignore_user_abort Off Off 
implicit_flush Off Off 
include_path .:/usr/lib/php .:/usr/lib/php 
log_errors Off Off 
log_errors_max_len 1024 1024 
magic_quotes_gpc On On 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off 
mail.force_extra_parameters no value no value 
max_execution_time 30 30 
max_input_nesting_level 64 64 
max_input_time -1 -1 
memory_limit 128M 128M 
open_basedir no value no value 
output_buffering 0 0 
output_handler no value no value 
post_max_size 8M 8M 
precision 14 14 
realpath_cache_size 16K 16K 
realpath_cache_ttl 120 120 
register_argc_argv On On 
register_globals On On 
register_long_arrays On On 
report_memleaks On On 
report_zend_debug On On 
safe_mode Off Off 
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
sendmail_from no value no value 
sendmail_path /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i  
serialize_precision 100 100 
short_open_tag On On 
SMTP localhost localhost 
smtp_port 25 25 
sql.safe_mode Off Off 
track_errors Off Off 
unserialize_callback_func no value no value 
upload_max_filesize 2M 2M 
upload_tmp_dir no value no value 
user_dir no value no value 
variables_order EGPCS EGPCS 
xmlrpc_error_number 0 0 
xmlrpc_errors Off Off 
y2k_compliance On On 
zend.ze1_compatibility_mode Off Off 


bcmath
BCMath support  enabled  


calendar
Calendar support  enabled  


cgi-fcgi
Directive Local Value Master Value 
cgi.check_shebang_line 1 1 
cgi.fix_pathinfo 1 1 
cgi.nph 0 0 
cgi.rfc2616_headers 0 0 
fastcgi.logging 1 1 


ctype
ctype functions  enabled  


curl
cURL support  enabled  
cURL Information  libcurl/7.19.5 OpenSSL/0.9.7a zlib/1.2.3 libidn/0.5.6  


date
date/time support  enabled  
"Olson" Timezone Database Version  2009.13  
Timezone Database  internal  
Default timezone  America/Sao_Paulo  

Directive Local Value Master Value 
date.default_latitude 31.7667 31.7667 
date.default_longitude 35.2333 35.2333 
date.sunrise_zenith 90.583333 90.583333 
date.sunset_zenith 90.583333 90.583333 
date.timezone no value no value 


dom
DOM/XML  enabled  
DOM/XML API Version  20031129  
libxml Version  2.7.3  
HTML Support  enabled  
XPath Support  enabled  
XPointer Support  enabled  
Schema Support  enabled  
RelaxNG Support  enabled  


exif
EXIF Support  enabled  
EXIF Version  1.4 $Id: exif.c 287371 2009-08-16 14:31:27Z iliaa $  
Supported EXIF Version  0220  
Supported filetypes  JPEG,TIFF  


filter
Input Validation and Filtering  enabled  
Revision  $Revision: 288083 $  

Directive Local Value Master Value 
filter.default unsafe_raw unsafe_raw 
filter.default_flags no value no value 


ftp
FTP support  enabled  


gd
GD Support  enabled  
GD Version  bundled (2.0.34 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
FreeType Version  2.1.9  
GIF Read Support  enabled  
GIF Create Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  
XPM Support  enabled  
XBM Support  enabled  


gettext
GetText Support  enabled  


hash
hash support  enabled  
Hashing Engines  md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5  


iconv
iconv support  enabled  
iconv implementation  glibc  
iconv library version  2.3.4  

Directive Local Value Master Value 
iconv.input_encoding ISO-8859-1 ISO-8859-1 
iconv.internal_encoding ISO-8859-1 ISO-8859-1 
iconv.output_encoding ISO-8859-1 ISO-8859-1 


imap
IMAP c-Client Version  2006k  
SSL Support  enabled  
Kerberos Support  enabled  


json
json support  enabled  
json version  1.2.1  


libxml
libXML support  active  
libXML Version  2.7.3  
libXML streams  enabled  


mbstring
Multibyte Support  enabled  
Multibyte string engine  libmbfl  
Multibyte (japanese) regex support  enabled  
Multibyte regex (oniguruma) version  4.4.4  
Multibyte regex (oniguruma) backtrack check  On  

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1. 

Directive Local Value Master Value 
mbstring.detect_order no value no value 
mbstring.encoding_translation Off Off 
mbstring.func_overload 0 0 
mbstring.http_input pass pass 
mbstring.http_output pass pass 
mbstring.internal_encoding no value no value 
mbstring.language neutral neutral 
mbstring.strict_detection Off Off 
mbstring.substitute_character no value no value 


mcrypt
mcrypt support enabled 
Version  2.5.8  
Api No  20021217  
Supported ciphers  cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes  
Supported modes  cbc cfb ctr ecb ncfb nofb ofb stream  

Directive Local Value Master Value 
mcrypt.algorithms_dir no value no value 
mcrypt.modes_dir no value no value 


mime_magic
mime_magic support enabled 

Directive Local Value Master Value 
mime_magic.debug Off Off 
mime_magic.magicfile /usr/local/apache/conf/magic /usr/local/apache/conf/magic 


mysql
MySQL Support enabled 
Active Persistent Links  0  
Active Links  0  
Client API version  5.0.89  
MYSQL_MODULE_TYPE  external  
MYSQL_SOCKET  /var/lib/mysql/mysql.sock  
MYSQL_INCLUDE  -I/usr/include/mysql  
MYSQL_LIBS  -L/usr/lib -lmysqlclient_r  

Directive Local Value Master Value 
mysql.allow_persistent On On 
mysql.connect_timeout 60 60 
mysql.default_host no value no value 
mysql.default_password no value no value 
mysql.default_port no value no value 
mysql.default_socket no value no value 
mysql.default_user no value no value 
mysql.max_links Unlimited Unlimited 
mysql.max_persistent Unlimited Unlimited 
mysql.trace_mode Off Off 


mysqli
MysqlI Support enabled 
Client API library version  5.0.89  
Client API header version  5.0.81  
MYSQLI_SOCKET  /var/lib/mysql/mysql.sock  

Directive Local Value Master Value 
mysqli.default_host no value no value 
mysqli.default_port 3306 3306 
mysqli.default_pw no value no value 
mysqli.default_socket no value no value 
mysqli.default_user no value no value 
mysqli.max_links Unlimited Unlimited 
mysqli.reconnect Off Off 


openssl
OpenSSL support  enabled  
OpenSSL Version  OpenSSL 0.9.7a Feb 19 2003  


pcre
PCRE (Perl Compatible Regular Expressions) Support  enabled  
PCRE Library Version  7.9 2009-04-11  

Directive Local Value Master Value 
pcre.backtrack_limit 100000 100000 
pcre.recursion_limit 100000 100000 


pgsql
PostgreSQL Support enabled 
PostgreSQL(libpq) Version  7.4.19  
Multibyte character support  enabled  
SSL support  enabled  
Active Persistent Links  0  
Active Links  0  

Directive Local Value Master Value 
pgsql.allow_persistent On On 
pgsql.auto_reset_persistent Off Off 
pgsql.ignore_notice Off Off 
pgsql.log_notice Off Off 
pgsql.max_links Unlimited Unlimited 
pgsql.max_persistent Unlimited Unlimited 


posix
Revision  $Revision: 286880 $  


Reflection
Reflection enabled 
Version  $Id: php_reflection.c 287991 2009-09-03 14:02:51Z sebastian $  


session
Session Support  enabled  
Registered save handlers  files user sqlite  
Registered serializer handlers  php php_binary  

Directive Local Value Master Value 
session.auto_start Off Off 
session.bug_compat_42 On On 
session.bug_compat_warn On On 
session.cache_expire 180 180 
session.cache_limiter nocache nocache 
session.cookie_domain no value no value 
session.cookie_httponly Off Off 
session.cookie_lifetime 0 0 
session.cookie_path / / 
session.cookie_secure Off Off 
session.entropy_file no value no value 
session.entropy_length 0 0 
session.gc_divisor 100 100 
session.gc_maxlifetime 1440 1440 
session.gc_probability 1 1 
session.hash_bits_per_character 4 4 
session.hash_function 0 0 
session.name PHPSESSID PHPSESSID 
session.referer_check no value no value 
session.save_handler files files 
session.save_path no value no value 
session.serialize_handler php php 
session.use_cookies On On 
session.use_only_cookies Off Off 
session.use_trans_sid 0 0 


SimpleXML
Simplexml support enabled 
Revision  $Revision: 272374 $  
Schema support  enabled  


sockets
Sockets Support  enabled  


SPL
SPL support enabled 
Interfaces  Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject  
Classes  AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RegexIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException  


SQLite
SQLite support enabled 
PECL Module version  2.0-dev $Id: sqlite.c 282740 2009-06-25 00:07:20Z scottmac $  
SQLite Library  2.8.17  
SQLite Encoding  UTF-8  

Directive Local Value Master Value 
sqlite.assoc_case 0 0 


standard
Regex Library  Bundled library enabled  
Dynamic Library Support  enabled  
Path to sendmail  /usr/sbin/sendmail -t -i  

Directive Local Value Master Value 
assert.active 1 1 
assert.bail 0 0 
assert.callback no value no value 
assert.quiet_eval 0 0 
assert.warning 1 1 
auto_detect_line_endings 0 0 
default_socket_timeout 60 60 
safe_mode_allowed_env_vars PHP_ PHP_ 
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH 
url_rewriter.tags a=href,area=href,frame=src,form=,fieldset= a=href,area=href,frame=src,form=,fieldset= 
user_agent no value no value 


tokenizer
Tokenizer Support  enabled  


xml
XML Support  active  
XML Namespace Support  active  
EXPAT Version  expat_1.95.7  


xmlreader
XMLReader  enabled  


xmlrpc
core library version  xmlrpc-epi v. 0.51  
php extension version  0.51  
author  Dan Libby  
homepage  http://xmlrpc-epi.sourceforge.net  
open sourced by  Epinions.com  


xmlwriter
XMLWriter  enabled  


xsl
XSL  enabled  
libxslt Version  1.1.24  
libxslt compiled against libxml Version  2.7.3  
EXSLT  enabled  
libexslt Version  1.1.24  


zip
Zip  enabled  
Extension Version  $Id: php_zip.c 287723 2009-08-26 02:16:41Z guenter $  
Zip version  1.8.11  
Libzip version  0.9.0  


zlib
ZLib Support  enabled  
Stream Wrapper support  compress.zlib://  
Stream Filter support  zlib.inflate, zlib.deflate  
Compiled Version  1.2.1.2  
Linked Version  1.2.3  

Directive Local Value Master Value 
zlib.output_compression Off Off 
zlib.output_compression_level -1 -1 
zlib.output_handler no value no value 


Additional Modules
Module Name 


Environment
Variable Value 
PATH  /usr/local/bin:/usr/bin:/bin  


PHP Variables
Variable Value 
PHP_SELF  /novo/php.php  
_REQUEST["__utmc"] 127130642 
_REQUEST["__utma"] 127130642.283502945.1268931511.1268931511.1268931511.1 
_REQUEST["__utmz"] 127130642.1268931511.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) 
_COOKIE["__utmc"] 127130642 
_COOKIE["__utma"] 127130642.283502945.1268931511.1268931511.1268931511.1 
_COOKIE["__utmz"] 127130642.1268931511.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) 
_SERVER["PATH"] /usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin 
_SERVER["FCGI_ROLE"] RESPONDER 
_SERVER["UNIQUE_ID"] o7aAEEKHN68AAHFWdrAAAACB 
_SERVER["HTTP_ACCEPT"] image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* 
_SERVER["HTTP_ACCEPT_LANGUAGE"] pt-br 
_SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB0.0; InfoPath.2; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) 
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate 
_SERVER["HTTP_HOST"] naturelavie.com.br 
_SERVER["HTTP_CONNECTION"] Keep-Alive 
_SERVER["HTTP_COOKIE"] __utmc=127130642; __utma=127130642.283502945.1268931511.1268931511.1268931511.1; __utmz=127130642.1268931511.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) 
_SERVER["SERVER_SIGNATURE"] no value 
_SERVER["SERVER_SOFTWARE"] Apache 
_SERVER["SERVER_NAME"] naturelavie.com.br 
_SERVER["SERVER_ADDR"] 66.135.55.175 
_SERVER["SERVER_PORT"] 80 
_SERVER["REMOTE_ADDR"] 189.83.199.138 
_SERVER["DOCUMENT_ROOT"] /home/nature/public_html 
_SERVER["SERVER_ADMIN"] webmaster@naturelavie.com.br 
_SERVER["SCRIPT_FILENAME"] /home/nature/public_html/novo/php.php 
_SERVER["REMOTE_PORT"] 61296 
_SERVER["GATEWAY_INTERFACE"] CGI/1.1 
_SERVER["SERVER_PROTOCOL"] HTTP/1.1 
_SERVER["REQUEST_METHOD"] GET 
_SERVER["QUERY_STRING"] no value 
_SERVER["REQUEST_URI"] /novo/php.php 
_SERVER["SCRIPT_NAME"] /novo/php.php 
_SERVER["PHP_SELF"] /novo/php.php 
_SERVER["REQUEST_TIME"] 1268933654 
_SERVER["argv"] Array
(
)
 
_SERVER["argc"] 0 
_ENV["PATH"] /usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin 
_ENV["FCGI_ROLE"] RESPONDER 
_ENV["UNIQUE_ID"] o7aAEEKHN68AAHFWdrAAAACB 
_ENV["HTTP_ACCEPT"] image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* 
_ENV["HTTP_ACCEPT_LANGUAGE"] pt-br 
_ENV["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB0.0; InfoPath.2; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) 
_ENV["HTTP_ACCEPT_ENCODING"] gzip, deflate 
_ENV["HTTP_HOST"] naturelavie.com.br 
_ENV["HTTP_CONNECTION"] Keep-Alive 
_ENV["HTTP_COOKIE"] __utmc=127130642; __utma=127130642.283502945.1268931511.1268931511.1268931511.1; __utmz=127130642.1268931511.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) 
_ENV["SERVER_SIGNATURE"] no value 
_ENV["SERVER_SOFTWARE"] Apache 
_ENV["SERVER_NAME"] naturelavie.com.br 
_ENV["SERVER_ADDR"] 66.135.55.175 
_ENV["SERVER_PORT"] 80 
_ENV["REMOTE_ADDR"] 189.83.199.138 
_ENV["DOCUMENT_ROOT"] /home/nature/public_html 
_ENV["SERVER_ADMIN"] webmaster@naturelavie.com.br 
_ENV["SCRIPT_FILENAME"] /home/nature/public_html/novo/php.php 
_ENV["REMOTE_PORT"] 61296 
_ENV["GATEWAY_INTERFACE"] CGI/1.1 
_ENV["SERVER_PROTOCOL"] HTTP/1.1 
_ENV["REQUEST_METHOD"] GET 
_ENV["QUERY_STRING"] no value 
_ENV["REQUEST_URI"] /novo/php.php 
_ENV["SCRIPT_NAME"] /novo/php.php 


PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE 

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net. 
 



Compartilhar este post


Link para o post
Compartilhar em outros sites

se a única diferença entre ambos é a necessidade de (de)codificação em utf-8, a diferença está na default charset/collation dos bancos mesmo

 

o que está estranho é que você está corrigindo a codificação com utf8_DEcode(). O que quer dizer que os dados do banco estão em utf e você está passando para iso. Codificação padrão do mysql(nem perguntei qual servidor que é) é latin1. Então o comum seria o contrário. Uma página montada sobre utf-8, recebendo dados em iso, deveria ser passada pela função utf8_ENcode()

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ok

 

mas no banco MySql tanto do servidor quanto aqui no localhost esta gravado assim:

 

São Francisco

Como o php poderia exibir:

São Francisco
?

O Colatio do mysql do servidor é utf8_general_ci

 

Segue my.ini do mysql local

# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory 
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option 
# "--defaults-file". 
#
# To run run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

[mysql]

default-character-set=utf8


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Arquivos de programas/Apache Software Foundation/mysql/"

#Path to the database root
datadir="C:/Arquivos de programas/Apache Software Foundation/mysql/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=0

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=5M


# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before.  This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8

#*** MyISAM Specific options

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method.  This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=8M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=8M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=212K


#*** INNODB Specific options ***


# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata
# information.  If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS.  As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=1M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system.  Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=8M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=10M

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olha só.

 

Fiz o arquivo abaixo assim para teste:

<?
$bairro="São Francisco";
$bairro2="São Francisco";
$ip = getenv("REMOTE_ADDR"); 
print $bairro;
print "<br>";
print $bairro2;
print "<br>";
print utf8_decode("Enddereço IP do computador que você esta usando: "); print $ip;
print "<br>";
print "Enddereço IP do computador que você esta usando: ". $ip;
print "<br>";
print "São Francisco e você";
?>

Rodando local retornou o seguinte:

São Francisco
São Francisco
Enddere?IP do computador que voc?sta usando: 127.0.0.1
Enddereço IP do computador que você esta usando: 127.0.0.1
São Francisco e você

Rodando no servidor hospedagem retornou o seguinte:

S�o Francisco
São Francisco
Enddere?IP do computador que voc?sta usando: 189.83.162.98
Enddere�o IP do computador que voc� esta usando: 189.83.162.98
S�o Francisco e voc

Onde será que esta o erro?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Gente.

Tudo começo assim:

 

Um form de cadastro de clientes que joga no Mysql assim:

 

<? if ($acao=="cad") {	
    $email = $_POST['email'];
	$senha = $_POST['senha']; 
	
	$nome = ucwords($_POST['nome']);
    $endereco = $_POST['endereco'];
    $numero = $_POST['numero'];
    $bairro = $_POST['bairro'];
    $cep = $_POST['cep'];
    $cidade = $_POST['cidade'];
    $estado = $_POST['estado'];
    $tel = $_POST['tel'];
    $cel = $_POST['cel'];
	
    if($link){
              $busca = mysql_query("SELECT nome FROM clientes where nome='$nome';") or die("A consulta falhou: " . mysql_error());
                    if(mysql_num_rows($busca) > 0){echo "Ola $nome, voce ja cadastrou o teu e-mail";}
					else {
                       $sql = "INSERT INTO clientes(email, senha, cpfcnpj, nome, endereco, numero, bairro, cep, cidade, estado, tel, cel,Bloqueio) VALUES('$email', '$senha', '$cpfcnpj', '$nome', '$endereco', '$numero', '$bairro', '$cep', '$cidade', '$estado', '$tel', '$cel','N')";
                       if(mysql_query($sql, $link)){

							$texto = "
									Olá $nome!
									Obrigado por ter se cadastrado conosco, e por favor nos ajude a divulgar o nosso trabalho.
									Agora, você receberá em primeira mão as novidades do nosso site nosso site.
									";
							$nome_cadastro = split(" ",$nome); 
					
							$mail = mail("$email", "Boas vindas ao nosso site","$texto","From: naturelavie@gmail.com\nDate: $date\n");
					      echo $texto;
					    
													}
  
                      else  {     echo("<H1>Olá $nome: não foi possivel realizar o Teu cadastro por favor tente novamente...</H1>");  } 
					    } 
    echo ("Erro de comunicação com o banco. Por favor tente mais tarde!");    
   	          }
			      }
?>

Bom, ai, tanto local quanto na web esta gravando o Bairro assim: são Francisco

 

Na hora de exibir os dados do novo cliente é que dá esse erro é que da esse erro

Compartilhar este post


Link para o post
Compartilhar em outros sites

não é um erro.. é a codificação...

 

coloque esta linha antes de exibir qualquer informação para a página:

 

header('content-type: text/html; charset=utf-8');

e LEMBRE-SE de salvar o arquivo com o charset equivalente

 

leitura recomendada

http://dev.mysql.com/doc/refman/5.0/en/charset-general.html

 

sempre crie seus bancos-de-dados definindo tanto charset quanto collation padrões

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.