Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got error 'Primary script unknown' with Apache alias outside document root

I've setup an Apache alias on a subdomain, which points to a directory outside the document root like this:

Alias / /home/keyhelp/www/webmail/plugins/xcalendar/caldav/

<Directory "/home/keyhelp/www/webmail/plugins/xcalendar/caldav">
    Require all granted
    AllowOverride All
</Directory>

This works as expected with a index.html file but not with index.php even if there is a .htaccess in the directory leading all requests to index.php.

In the Apache error log I get:

[Thu Mar 31 08:50:08.574396 2022] [proxy_fcgi:error] [pid 376501:tid 140039026099968] [client XX.XX.XXX.XXX:58410] AH01071: Got error 'Primary script unknown'

System: Debian 11.3, Apache 2.4.53, PHP 7.4.28

Thanks!

like image 490
Thomas D. Avatar asked Sep 06 '25 03:09

Thomas D.


1 Answers

So it turned out to be a permission issue. I found this thread which helped me to track down the issue, as I'm also using php-fpm. I needed to add the executable bit for others on the keyhelp directory, which was the only directory in the tree without this bit set, by using:

chmod +x /home/keyhelp

And I needed to add the path /home/keyhelp/www to the open_basedir config of php. Now everything is working fine.

like image 125
Thomas D. Avatar answered Sep 07 '25 22:09

Thomas D.