简体   繁体   中英

Allow access to stand-alone php file Wordpress

I am developing a wordpress theme and I want to use jQuery.load() to load data from a PHP file in my theme directory called process.php to a div in a wordpress page template.

I haven't had any issues with load() in the past but Wordpress is preventing me from loading the data or even accessing the process.php file in the browser.

When I navigate to the full path of the file (eg: http://[site]/[theme]/functions/process.php ) I get the following error in Chrome

Internal Server Error.

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, * *@gmial.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I've read similar questions but they involve modifying the .htaccess file. Does anyone know how to do this from a theme perspective ie: using $wp_rewrite .

EDIT

Linux Server error log states [Mon Mar 12 14:00:52 2012] [error] [client 121.98.81.237] SoftException in Application.cpp:245: File "/var/www/vhosts/****.co.nz/httpdocs/npr/wp-content/themes/_s_2/functions/process.php" is writeable by group [Mon Mar 12 14:00:52 2012] [error] [client 121.98.81.237] Premature end of script headers: process.php

and this is process.php

<?php 
echo "hello from php";
?>

I think the better way is use by init action and check the $_GET/$_POST , and return the string you want.. and if all ok, you can die() the script.

For this way you get access to wordpress db and all..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM