0

I hope to create a directory wp-mybiz as same level as wp-content, wp-admin, and wp-includes under site root directory to collect my business logic codes.

But if I try to visit php using url http://example.com/site/wp-mybiz/mycode.php, it get raw php file rather than html file generated by this php.

Any wrong to configure apache, wordpress, or php?

  • 1
    what content you have written to that PHP. Have you added any header() to that PHP? – Aftab Jul 27 '16 at 8:49
  • 2
    "to collect my business logic codes" - I think you'd normally put these in your theme, or in a plugin specific to your site. What sort of function are you adding, and are you changing the WP core files? – Rup Jul 27 '16 at 8:53
  • 2
    If you use WordPress then embrace it. It's always best to do things the WordPress way (same for any framework). As @Rup says, put your code into a plugin or theme. – Andy Macaulay-Brook Jul 27 '16 at 9:36
1

Only Apache is "responsible for caring" that your script is PHP. AFAIK, whether you need to use AddHandler or AddType depends on whether your PHP is installed as a module or as CGI. You can try creating .htaccess in wp-mybiz/ folder containg some of the common solutions/workarounds

1) AddType application/x-httpd-php .php

2a) AddHandler application/x-httpd-php .php 2b) AddHandler x-httpd-php .php

or a combination of both.

To help isolate the real issue clear your cache and get the headers (i.e. via 'Live HTTP Headers" or similar).

Edit: Excellent thread - https://www.webmasterworld.com/apache/4557229.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.