Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6877875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:39:13+00:00 2026-05-27T04:39:13+00:00

I wrote a PHP script on my local server which needs to include path

  • 0

I wrote a PHP script on my local server which needs to include path for the file where I need to write contents to the file using file_put_contents which was working without any problem on the localhost. I moved the files to the webserver where it has been configured with the path which has spaces in between
for ex:
C:\Program File (xxx)\Apache Software Foundation\Apache2.2\htdocs\writtencode\writefile\

When I try to open the folder writefile to write the contents to temp_1.cfg file in that folder it pops up the error

Warning:
file_put_contents(C:\ProgramFile(xxx)\ApacheSoftwareFoundation\Apache2.2\htdocs\writtencode\writefile\temp_1.cgf)
[function.file-put-contents]: failed to open stream: No such file or
directory in C:\Program File (xxx)\Apache Software
Foundation\Apache2.2\htdocs\writtencode\writefile\index.php

Any idea how to remove or tackle with the problem of spaces in the path when writing contents to the file using file_put_contents?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:39:14+00:00Added an answer on May 27, 2026 at 4:39 am

    Have you tried enclosing the path in quote marks?
    Also you may need to escape all backslashes so:

    file_put_content(C:\ProgramFile(xxx)\ApacheSoftwareFoundation\Apache2.2\htdocs\writtencode\writefile\temp_1.cgf);

    becomes:

    file_put_content('C:\\ProgramFile(xxx)\\ApacheSoftwareFoundation\\Apache2.2\\htdocs\\writtencode\\writefile\\temp_1.cgf');

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SOLVED: I wrote and tested a PHP script on the local server. (Nothing fancy,
I wrote a PHP script which will run every Monday using cron. In this
I want to write a php script that keeps the apache_log file open and
How can you allow a PHP script to write to a file with high-security
I wrote a function which runs a php script and returns its output. I
What I'm after is a PHP-script which will provide a local copy of a
I wrote a php script which outputs html files on the screen which uses
I just wrote a PHP login script, and what I'm trying to accomplish is
I am trying to write a PHP script that can upload multiple files. for($i=0;$i<count($_FILES['uploadimg']['name']);$i++){
I am trying to write a PHP script that uses the pdftk app to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.