How to Run PHP files that are named in Arabic

Alles, was PHP betrifft, kann hier besprochen werden.

How to Run PHP files that are named in Arabic

Postby mh.hamad » 04. November 2009 09:52

Hello dears,, please I need to know if there is any way to run php files that are named not using english characters, like Arabic, there must be some module out there but I have been googling for days,,, any help please other than renaming the files !!!
mh.hamad
 
Posts: 5
Joined: 04. November 2009 09:46

Re: How to Run PHP files that are named in Arabic

Postby Nobbie » 04. November 2009 10:45

Its not a question of PHP or Apache or Xampp, its simply a question of character sets. The character set used for the file system must support arabic characters and you should use the same character set in the Editor that you use to create the PHP Scripts.

I think utf8 should support arabic characters, there is no problem to use editors which use utf8, but I have no idea which operating system you use and if the file system supports utf8.
Nobbie
 
Posts: 6995
Joined: 09. March 2008 13:04

Re: How to Run PHP files that are named in Arabic

Postby mh.hamad » 04. November 2009 13:34

I appreciate your reply, but maybe i need to give more details:
My OS is win2003, and I believe that I have Arabic supported correctly because I can successfully run such files (With Arabic Names) in case the extension was HTML, but the same file when converted to php becomes useless, like the Apache cannot find the file but with a different error:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/server/www/site/عرض.php' (include_path='.;C:\php5\pear') in Unknown on line 0


NOTE: I am using utf8 encoding and you are right it supports Arabic, but after looking at the whole issue I am not sure if it is a problem of encoding.


Any ideas ??
mh.hamad
 
Posts: 5
Joined: 04. November 2009 09:46

Re: How to Run PHP files that are named in Arabic

Postby Nobbie » 04. November 2009 16:57

How do you trigger the execution of the PHP Script?

Do you either

a) click a link in a HTML Document?
b) enter an URL in the Browser Input Line?
c) run a different PHP Script, which includes the arabic one?

It is very difficult to help as you really dont offer many informations. Never forget: we cannot see your PC, we cannot see your monitor, we dont know anything about your scripts, about your PHP, about your webserver, about your development environment. We simply see nothing and know nothing, Only the very few words you supply here.
Nobbie
 
Posts: 6995
Joined: 09. March 2008 13:04

Re: How to Run PHP files that are named in Arabic

Postby Wiedmann » 05. November 2009 08:12

if there is any way to run php files that are named not using english characters, like Arabic,

No. Not directly.

If you want access such file through Apache, you can do some mod_rewrite, and map an uri with Arabic characters to a filename which PHP can access.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: How to Run PHP files that are named in Arabic

Postby mh.hamad » 05. November 2009 08:28

you can do some mod_rewrite, and map an uri with Arabic characters to a filename which PHP can access

I have been looking for such an answer, I don't know how to do that but now I have the correct keywords, I will try to work it out and update you with news.

Thanks,
mh.hamad
 
Posts: 5
Joined: 04. November 2009 09:46

Re: How to Run PHP files that are named in Arabic

Postby Nobbie » 05. November 2009 09:30

Wiedmann wrote:If you want access such file through Apache, you can do some mod_rewrite, and map an uri with Arabic characters to a filename which PHP can access.


What effectively ends up in renaming the PHP script, what he did not want:

any help please other than renaming the files !!!
Nobbie
 
Posts: 6995
Joined: 09. March 2008 13:04

Re: How to Run PHP files that are named in Arabic

Postby mh.hamad » 05. November 2009 10:04

What effectively ends up in renaming the PHP script, what he did not want:


As I have understood I will not have to rename the PHP file, am I right, Apache will use the module to use some characters that it understands but the name I assigned will stay the same, this will work for me as it does not matter for me actually what is going inside Apache's brains.... I haven't tried it yet but I hope I didn't get it the wrong way !!
mh.hamad
 
Posts: 5
Joined: 04. November 2009 09:46

Re: How to Run PHP files that are named in Arabic

Postby Nobbie » 05. November 2009 12:52

mh.hamad wrote:As I have understood I will not have to rename the PHP file, am I right, Apache will use the module to use some characters that it understands but the name I assigned will stay the same, this will work for me as it does not matter for me actually what is going inside Apache's brains.... I haven't tried it yet but I hope I didn't get it the wrong way !!


Sorry, you got it wrong, sir!

It just works vice verse: you MUST rename the file at first, as PHP (obviously - I did not check that further more) cannot load files with multibyte characters (I think, that may be the reason). You can only keep the arabic names and the links in your HTML documents (if they contain arabic letters), but you have to rename the physical file and with the usage of mod_rewrite you may change the physical request from the arabic name into the (newly renamed) english name. That's what "Wiedmann" told you to do. And (if PHP really cannot load files with multibyte characters in the name) there will be no other solution.

And as you have to change the filenames anyway, I am not sure whether you need to use mod_rewrite, as I dont know if you need to "show" the physical filenames to the end-user. I cannot find any sense in using special names for PHP scripts, as these are usually hidden in links or actions etc. - usually a client does not care for filenames. So you also should change the HTML documents, i.e. the links and actions etc.
Nobbie
 
Posts: 6995
Joined: 09. March 2008 13:04

Re: How to Run PHP files that are named in Arabic

Postby mh.hamad » 05. November 2009 14:06

I give up ...

I will rename the files to english, thank you guys for your concern ...
mh.hamad
 
Posts: 5
Joined: 04. November 2009 09:46

Re: How to Run PHP files that are named in Arabic

Postby rudelyn » 09. December 2009 14:00

^it's really hard. I can't even do it myself and i've been coding for years.

Regards,
Rudelyn
rudelyn
 
Posts: 1
Joined: 09. December 2009 13:56


Return to PHP

Who is online

Users browsing this forum: No registered users and 3 guests