webnoob
webnoob

Reputation: 15934

Path type for PHP opendir()

Seems a little bit of an odd question to be asking. What path does opendir() expect?

When I try: opendir('/home/myuser/public_html'); and get this [function.opendir]: failed to open dir: No such file or directory.

If that path isn't correct, what should it be?

Upvotes: 0

Views: 3101

Answers (2)

Naveen
Naveen

Reputation: 230

You should use relative paths.. For example: If your PHP App resides in /opt/project then you should use it as ('../../home/myuser/public_html')

Upvotes: 0

Pekka
Pekka

Reputation: 449415

The syntax you use is fine. (see the PHP Manual on opendir)

The path either doesn't exist, or the PHP user doesn't have the right to access it.

Upvotes: 3

Related Questions