Ibrahim Azhar Armar
Ibrahim Azhar Armar

Reputation: 25745

PHP files does not execute in windows machine

i created the application in PHP on my mac osx. and after the development i zipped and transferred to the windows 7 machine. and when i tried opening it i get this error.

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/wamp/www/app/index.php' (include_path='.;C:\php\pear') in Unknown on line 0

the above error suggest, the error is caused because of the file permission issue, is there any possible way i can fix this error in windows itself.?

thank you..

Upvotes: 3

Views: 13163

Answers (10)

D. Pardal
D. Pardal

Reputation: 6597

For me, the problem was that the requested file was in my OneDrive folder. I moved the DocumentRoot out of OneDrive and it all worked!

Upvotes: 3

binaryfunt
binaryfunt

Reputation: 7127

For me, this was apparently caused by having the aliased folder in a different drive to the C:/ drive. I moved the folder to C:/ drive and it rectified the problem.

Upvotes: 1

Guest892544
Guest892544

Reputation: 21

In my case index.php worked for other sites. To the site that had problems index.html file worked but not index.php. It caused the error message like in the first message of this thread.

The culprit was scandinavian 'ä' in the directory path of the site on Windows's file system of my site. I changed it to 'a' and restarted the server. That solved the problem.

Upvotes: 2

Mohsin
Mohsin

Reputation: 75

In your cmd try to run your project with the following command

php -S localhost:8000 -t public

Upvotes: 4

Elías Gómez
Elías Gómez

Reputation: 121

I had the same problem with UwAmp. I solved it changing the name of a folder on my path, from Formación to Formacion, removing the accent mark, that seems to be a problem.

Upvotes: 1

Ibrahim Azhar Armar
Ibrahim Azhar Armar

Reputation: 25745

For the people who wants to know how i solved this.

The issue was with the file permission of index.php file, when i changed the file permission for index.php it worked.

Upvotes: -1

Tom
Tom

Reputation: 130

I had this and found that it was because the index.php file was set with encryption.

For anyone that wants to rule it out - right click the php file, select 'properties' then click the 'advanced' button and uncheck the 'Encrypt contents to secure data' check box and click 'O.K'. This worked for me, so just putting it out there.

Upvotes: 10

user1074324
user1074324

Reputation:

It looks like something is messed up in your code when requiring a file:

C:/wamp/www/app/index.php

Is not a valid path on a windows machine, windows uses "\" for a directory separator while linux/unix/mac uses a "/".

In PHP never hard code directory slashes, use the constant:

DIRECTORY_SEPARATOR

To allow your code to run seamlessly on any platform.

Upvotes: 0

Chillie
Chillie

Reputation: 1026

It sounds like a permissions problem you would need to right click on the document Properties > Security Click on everybody or SYSTEM depending on if its XP or win 7/Vista edit thier permissions to allow them to read and execute.

For Reference Click Here

Upvotes: 0

Thomas
Thomas

Reputation: 222

you must set permissions for SYSTEM's group, not only for your current user. Properties -> security (or something like that), then select SYSTEM > Edit > Allow Full Control > OK

Upvotes: 0

Related Questions