php code unable to change to or recognize custom web location

mik3ca

Verified User
Joined
May 31, 2026
Messages
12
To make my website run faster, I decided to store it on a ramdrive (and it reloads onto the ramdrive on each system restart).

Lets say my domain is example.com, the username for that domain is example, and the Root folder of the ramdrive is /mywww

and I have this structure:
/mywww
-- /mywww/includes (php include files folder)
-- /mywww/includes/item.php
-- /mywww/site (php core website files folder)
-- /mywww/site/index.php (main site)

The contents of /mywww/site/index.php is:

Code:
<?php
chdir ("/mywww/site");
include "/mywww/includes/item.php";
runincludefunction();
?>

The contents of /mywww/includes/item.php is:

Code:
<?php
function runincludefunction(){
echo "It works";
}
?>

In the /home/example/domains folder that directadmin created, I deleted all the contents, recreated the public_html folder, set the permission/ownerships to the correct user permissions/ownerships and used mount --bind to map /mywww to public_html.


when I try accessing the domain with CURL, I get a 500 Internal server error. (using a web browser wont help).
When I look at the error log, it shows that the code for index.php is processed but its claiming the /mywww/site folder does not exist (gives error code 2) and it does not even load the file /mywww/includes/item.php claiming that runincludefunction() does not exist.

How do I fix this?

The setup is Apache with proxy_fcgi with php 8 in php_fpm mode.
I never had this problem a long time ago when I used php 5 as a dso module in apache (no php_fpm).
 
Back
Top