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 823499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:57:25+00:00 2026-05-15T02:57:25+00:00

It should be so simple. I’ve followed every tutorial and forum I could find,

  • 0

It should be so simple. I’ve followed every tutorial and forum I could find, yet I can’t get it to work. I simply want to build a RESTful API in PHP on Apache2.

In my VirtualHost directive I say:

<Directory />
    AllowOverride All
    <Limit GET HEAD POST PUT DELETE OPTIONS>
        Order Allow,Deny
        Allow from all
    </Limit>
</Directory>

Yet every PUT request I make to the server, I get 405 method not supported.

Someone advocated using the Script directive, but since I use mod_php, as opposed to CGI, I don’t see why that would work.

People mention using WebDAV, but to me that seems like overkill. After all, I don’t need DAV locking, a DAV filesystem, etc. All I want to do is pass the request on to a PHP script and handle everything myself. I only want to enable PUT and DELETE for the clean semantics.

  • 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-15T02:57:26+00:00Added an answer on May 15, 2026 at 2:57 am

    You don’t need to configure anything. Just make sure that the requests map to your PHP file and use requests with path info. For example, if you have in the root a file named handler.php with this content:

    <?php
    
    var_dump($_SERVER['REQUEST_METHOD']);
    var_dump($_SERVER['REQUEST_URI']);
    var_dump($_SERVER['PATH_INFO']);
    
    if (($stream = fopen('php://input', "r")) !== FALSE)
        var_dump(stream_get_contents($stream));
    

    The following HTTP request would work:

    Established connection with 127.0.0.1 on port 81
    PUT /handler.php/bla/foo HTTP/1.1
    Host: localhost:81
    Content-length: 5
     
    boo
    HTTP/1.1 200 OK
    Date: Sat, 29 May 2010 16:00:20 GMT
    Server: Apache/2.2.13 (Win32) PHP/5.3.0
    X-Powered-By: PHP/5.3.0
    Content-Length: 89
    Content-Type: text/html
     
    string(3) "PUT"
    string(20) "/handler.php/bla/foo"
    string(8) "/bla/foo"
    string(5) "boo
    "
    Connection closed remotely.
    

    You can hide the “php” extension with MultiViews or you can make URLs completely logical with mod_rewrite.

    See also the documentation for the AcceptPathInfo directive and this question on how to make PHP not parse POST data when enctype is multipart/form-data.

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

Sidebar

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.