htaccess php version change & wrong encoding - php

I'm strugelling with strange problem. My hosting provider do not offer cpanel with PHP config option (i know, disaster). For the purpouses of my website I had to change PHP version from 5.2 to 5.5. So admin told me i can use htaccess and command: AddHandler php5.5-fastcgi php
And ok - it activates proper PHP version, but what is totally strange -> change totally my mysql database encoding. The output is following - all posts, pages etc. which were previously displayed in my native language (polish) right now do not display polish diacritic symbols. I've tried to change the whole database collation to UTF8_general_CI yet it didnt solve the problem. I use wordpress as cms, but the issue appears also in my own cms, as well as plain php with mysql. Any ideas how to change that? thanks!

Related

Broken TYPO3 front-end (encoding)

I have a TYPO3 4.5.37 website which works perfect on my local windows enviorement, but after uploading it to a Linux environment I get a broken front-end (the back-end is functioning normally) see:
What I already tried;
Converted all database tables to a utf8_general_ci collation
[BE][forceCharset] = utf-8
[SYS][setDBinit] = SET NAMES utf8;
When I drop my database (so there is no connection) the problem with the output is still there so I think this has nothing to do with the database.
The website outputs the front-end with TemplaVoila, I updated TemplaVoila from 1.6.x to 1.9.2 but this didn't work.
On the same server are a lot of other working TYPO3 sites hosted so this has probably nothing to do with the server settings.
I'm running out of options now. So I hope somebody can help me out here.
I found the problem. The compressionLevel was set to '1' in the install tool, when turned off the problem with the encoding on the front-end disappeared.
[FE][compressionLevel]
Determines output compression of BE output. Makes output smaller but
slows down the page generation depending on the compression level.
Requires a) zlib in your PHP installation and b) special rewrite rules
for .css.gzip and .js.gzip (please see _.htacces for an example).
Range 1-9, where 1 is least compression and 9 is greatest compression.
'true' as value will set the compression based on the PHP default
settings (usually 5). Suggested and most optimal value is 5.

Troubles Displaying Arabic Text

I have this website, websiteaddress.com where I'm facing troubles displaying arabic text. Arabic text shows (?????) question marks only.
I had two sessions of chatting with support, but, no result so far.
These options have been tested and didn't solve the issue:
No database connection is actually established for Arabic text. All arabic text is static, no database entries. So, database encoding isn't an issue.
The site is based on wordpress, encoding in settings is set to "UTF-8". Also tried the ISO-8859-1, both gave the same result. (the arabic text doesn't come from the wordpress databse, it's hardcoded within the theme files)
added a default charset to htaccess to UTF-8 as well as ISO-8859-1.
Resent the headers using PHP with UTF-8 encoding and also tried ISO-8859-1.
changed the PHP.INI in my hosting root directory and also under this specific account root directory and changed the encoding from ISO to UTF-8.
So, all the above did not solve the issue.
Also, I have created two testing pages, with exactly the same text inside (in arabic): websiteaddress.com/test.html and websiteaddress.com/test.php .. both were the same pages, I just changed the extensions of the files. The html works fine and displays arabic. The php one doesn't work and displays questions marks.
This is basically the issue.
If anyone has any other option for me to try or know how to go about doing this, please let me know!
I have searched alot on stackoverflow and found alot of solutions, mostly all the above solutions were mentioned in some questions on stackoverflow. But, none of them answered my question, hence the post here..
Thanks and have a great day everyone!
It was solved by my hosting provider, just in case anyone need this. This is their reply:
I checked the php.ini and the changes were not made in there, so I changed them for you. I also edited the following in your php.ini. exif.encode_unicode I set it to UTF-8 and uncommented it. Now the arabic is rendering at: websiteaddress.com/test.php and websiteaddress.com/test.html You can add the following to your .htaccess to get a different php version rendered. The following code is for 5.3. AddType application/x-httpd-php53 .php

Trouble with php code after moving from old windows host to new host running linux.

Recently we moved our site from old windows based host running an old php to new linux host running latest php/mysql.
I managed to fix quite few problems but there are two that are eluding me.
First one are non working numbers to switch to new "page" in our inventory.
e.g. -> http://adepto.hr/adepto_promotivni_artikli.php?kat=10&start=0
When you click on any of the above number nothing happens. It's same on all other categories. Here is page code. As I said, I managed to fix some errors that were caused by outdated code, but can't sort this one out.
http://pastebin.com/fbxZdgS5
Second one are the Croatian letters which are not showing correctly. ( e.g. čćšđž).
I'v tried declaring it in php files but without luck. What would be the correct way to declare/define this character set ?
Thank you,
Saturnij
I can't see where $start is instantiated. Looks like you're missing a $start = $_GET['start']
You should also be saving your PHP files as UTF-8 rather than ISO-8859-1 if you want good character set support.

Dreamweaver showing boxes instead of unicode characters

My pages when viewed in browser are working fine. I have a language file (in .php extension), but without any HTML tags. I m using Dreamweaver CS5.5 to edit these files.
I have a variable $lang["label_name"], which holds the value. in dreamweaver code view, all the devnagari unicode character appears as boxes. But in another machine, with same version of dreamweaver, when same file is opened, the unicode characters are showing correctly.
Is there any settings that I missed in my machine? How to make unicode character appear correctly in Dreamweaver (not talking about browser)?
Thanks
Is there any settings that I missed in my machine?
Probably. Just compare the setup between the two dreamweaver installations and add the differences to your question. This might then be easier to say.
How to make unicode character appear correctly in Dreamweaver (not talking about browser)?
By configuring it properly. Also ensure that you are using the same font on both systems and the files have the same encoding and Dreamweaver is aware of the correct encoding.

Configure WampServer for non-Latin web adresses

I have installed WordPress locally on WampServer for testing purposes. I discovered that when I changed the permalinks structure to reflect post title (the title is in my native language 'Urdu'), and requested the following page in browser
http://localhost/blog/طوفان-اور-سیاست-دان/
it returned a 404 error which said
The requested URL /blog/طوÙان-اور-سیاست-دان/ was not found on this server.
I am using WampServer 2.2 and WordPress 3.4.
Since many PCs don't have an Urdu font installed, here is the image of first address for you.
The English translation for urdu part is "Storm-and-politicians" . Urdu, unlike English, is written from right to left.
How can I configure my local web server to accept web adresses in Urdu? Many sites including the Urdu wikipedia use this scheme.
How to learn more about this problem:
Each time you see apache giving you a not-found message, you will find an according entry in the error log of your webserver. It contains more information what happens behind the scenes.
For example you will see a message similar to this one:
File does not exist: C:/.../htdocs/blog/\xd8\xb7\xd9\x88\xd9\x81\xd8\xa7\xd9\x86-\xd8\xa7\xd9\x88\xd8\xb1-\xd8\xb3\xdb\x8c\xd8\xa7\xd8\xb3\xd8\xaa-\xd8\xaf\xd8\xa7\xd9\x86
This is useful because it allows you to see the binary sequence the apache webserver uses to query your file-system for the file.
You can turn this into a PHP string to decipher it:
echo "\xd8\xb7\xd9\x88\xd9\x81\xd8\xa7\xd9\x86-\xd8\xa7\xd9\x88\xd8\xb1-\xd8\xb3\xdb\x8c\xd8\xa7\xd8\xb3\xd8\xaa-\xd8\xaf\xd8\xa7\xd9\x86";
Depending in which encoding you view this output, it can look like the following:
UTF-8 : طوفان-اور-سیاست-دان
Ansi : ÏÀ┘ê┘üϺ┘å-Ϻ┘êÏ▒-Ï│█îϺÏ│Ϭ-ϻϺ┘å
ISO-8859-1: طوÙان-اور-سیاست-دان
Apart from having this looking differently, the question is why does the webserver not find this file?
As you write you use wordpress, you probably just have missed to enable these type of URLs, in Wordpress jargon those are called "Pretty" permalinksCodex.

Categories