changing forward slash to backslash in PHP IIS

Posted on 2011-05-05
Last Modified: 2012-05-11
Hi folks,

I'm having a minor issue with an app I'm installing (a mod for Magento's ecommerce platform to be precise) and I know on Windows PHP can use either / or \ in directory structure, but I'm getting an error running my app that looks like this:

error loading: "C:\Inetpub\wwwroot\subdomains\tools\magento\var\import/test_import.csv".

you can see the / right before test_import.csv being the problem (it needs to be a \ too) - what I'm wondering is, would that be a PHP config issue, an IIS config issue, or does that look like it might be something in the app code I'm trying to run?


Question by:merv109
    LVL 15

    Accepted Solution

    IF you want to use \ then try using \\ for every \ or you can use all / Like:


    LVL 4

    Expert Comment

    my guess would be an error in the code
    LVL 107

    Assisted Solution

    by:Ray Paseur
    PHP has a predefined constant that is environmentally aware.  Instead of using a slash in the code, use DIRECTORY_SEPARATOR instead.
    LVL 12

    Expert Comment

    The constants that are used in magento are: "PS" and "DS".

    Author Closing Comment


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
    Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now