AH01071: Got error 'Primary script unknown\n' with CB2 & Apache 2.4.9

iworx

Verified User
Joined
Nov 21, 2006
Messages
56
I've been reading through a lot of posts with older versions of this and it seems everything is solved by now, except for 1 site on a brand new CentOS 6.5 box.

[Sat May 31 18:09:41.764808 2014] [proxy_fcgi:error] [pid 22260:tid 140089577563904] [client xxx.xxx.xxx.xxx:35765] AH01071: Got error 'Primary script unknown\n'

Code:
#PHP Settings
php1_release=5.5
php1_mode=php-fpm
php2_release=5.4
php2_mode=suphp
opcache=no
htscanner=no
php_ini=no
php_timezone=Europe/Paris
php_ini_type=production
ioncube=no
zend=no
suhosin=no
x_mail_header=yes

#MySQL Settings
mysql=5.6
mysql_inst=no
mysql_backup=yes
mysql_backup_dir=/usr/local/directadmin/custombuild/mysql_backups
mysql_force_compile=no

#WEB Server Settings
webserver=apache
apache_ver=2.4
apache_mpm=auto
mod_ruid2=no
secure_htaccess=no
harden_symlinks_patch=yes
use_hostname_for_alias=auto
redirect_host=tank.cloudz.be
redirect_host_https=no

#WEB Applications Settings
phpmyadmin=yes
phpmyadmin_ver=4
squirrelmail=yes
roundcube=yes

#ClamAV-related Settings
clamav=no
clamav_exim=yes
proftpd_uploadscan=no
pureftpd_uploadscan=no
suhosin_php_uploadscan=no

#Mail Settings
exim=yes
eximconf=no
spamassassin=no
dovecot=yes
pigeonhole=no

#Jail Settings
jail=no

#FTP Settings
ftpd=pureftpd

#Statistics Settings
awstats=no
webalizer=yes

#CustomBuild Settings
custombuild=2.0
autover=no
bold=yes
clean=yes
cleanapache=yes
clean_old_tarballs=yes
clean_old_webapps=yes
downloadserver=files.directadmin.com
Any changes required to get this up and running?

The site is running an ExpressionEngine 2.4.0 site with the default index.php removal .htaccess

Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
The site itself uses the Pages module for showing the files. The control panel is working as it should.
I tried it both with 5.5 PHP-FPM and the 5.4 SuPHP versions.

Some insight will be welcome.
 

dczepierga

New member
Joined
Jun 1, 2014
Messages
3
I had really similar problem after update to Apache 2.4.9 - i had this same error...

Do you run
Code:
./build rewrite_confs
after update?

If yes you have this same problem which i have - wrong detect of Apache version during `rewrite_confs` method.

I solved my issue by analysing generated virtual host file - try to compare it with template and check section with condition
Code:
HAVE_PHP1_FPM_NEW
and
Code:
HAVE_PHP2_FPM_NEW
- both shouldn't appear in generated virtual host file on Apache 2.4.9. I create custom virtualhost templates where i copy all templates and remove section with this condition - after do this and call
Code:
./build rewrite_confs
everything start to work...

Maybe this solution help you, if yes pls write i will create bug report for this...
For now I try to find why DA build generate virtualhost file wrong, but i cannot find anything... I have 3 other servers with DA and Apache 2.4.9 and there everything works... only on this one i have problems with this...
 

iworx

Verified User
Joined
Nov 21, 2006
Messages
56
It should be

Code:
HAVE_PHP1_FPM_OLD
and
Code:
HAVE_PHP2_FPM_OLD
My mistake ;)
I currently rolled back to mod_php & mod_ruid2 until it comes fixed in Custombuild.
Server is in production, don't risk to 'trial and error' at this moment :)
But thanks for your input!
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
8,751
Location
LT, EU
You should not use any customized templates with Apache 2.4.9 & latest version of DA, because they have been changed and your customizations might be the cause (/usr/local/directadmin/data/templates/custom).
 

iworx

Verified User
Joined
Nov 21, 2006
Messages
56
You should not use any customized templates with Apache 2.4.9 & latest version of DA, because they have been changed and your customizations might be the cause (/usr/local/directadmin/data/templates/custom).
I did a clean install on a brand new server. Never used customised templates. Still had that problem.
 

dczepierga

New member
Joined
Jun 1, 2014
Messages
3
You should not use any customized templates with Apache 2.4.9 & latest version of DA, because they have been changed and your customizations might be the cause (/usr/local/directadmin/data/templates/custom).
Yes i agree but i don't have any other solution for this problem...

I don't know why during the conf build DA set `HAVE_PHP1_FPM` and `HAVE_PHP1_FPM_OLD` to "1" - this value should be set only on first variable (on Apache 2.4.9).
Maybe someone know where this value is set or cached?

On other 3 servers everything works ok, only on this one (my oldest server with CB2) have problem with it... The most weird thing is that the virtualhost secure section (virtual_host2_secure.conf) is generated correctly and the normal one is generated wrong... (virtual_host2.conf).
I check templates in other servers and are the same, also i don't have custom templates (only now to temporary fix this problem, but for test i remove them).
Any idea where could be a problem?
 

StroeveICT

New member
Joined
Apr 15, 2013
Messages
3
I've got the same problem.
But I did find what is causing the problem.
In the .htaccess the last line contains this:
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
After I change this to the following line the error has gone away.
Code:
RewriteRule ^(.*)$ /index.php?page=$1 [L]
I don't know why this doesn't work anymore like this but maybe someone else does.
 

iworx

Verified User
Joined
Nov 21, 2006
Messages
56
I've got the same problem.
But I did find what is causing the problem.
In the .htaccess the last line contains this:
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
After I change this to the following line the error has gone away.
Code:
RewriteRule ^(.*)$ /index.php?page=$1 [L]
I don't know why this doesn't work anymore like this but maybe someone else does.
Going further on your findings - I went back to the EE site and it seems they added this at the bottom:

http://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

Some common problems include links returning 404s, a “No Input File Specified” error, or all links returning the same content. This can often be the case with hosts (such as GoDaddy) that require you to force query strings. If this happens, follow the exception above for hosts that force query strings.
I will run the php-fpm install again today and give it another try. Thanks for the intel.
 

edvanleeuwen

Verified User
Joined
Nov 18, 2013
Messages
112
I have just run build update and succesfully installed Apache 2.4.9. When updating PHP 5.5.8 to 5.5.14 I got the error mentioned above. What can I check to see what I am doing wrong?

Update: did a completely new php installation and now it works.
 
Last edited:

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
I've just upgraded a server to Apache 2.4.10 and after a rewrite_confs all PHP settings were wiped out from the httpd.conf files.
We're using custom virtualhost templates which only include |*if HAVE_PHP1_FPM="1"| but apparently that doesn't work, DA is still looking for |*if HAVE_PHP1_FPM_OLD="1"|

Code:
FreeBSD 9
CB 2.0.0-RC7 (rev: 910)
#PHP settings.
php1_release=5.4
php2_release=5.5
php1_mode=php-fpm
php2_mode=php-fpm
opcache=no
htscanner=yes
php_ini=no
php_timezone=CET
php_ini_type=production
ioncube=yes
x_mail_header=yes
zend=no
suhosin=no
suhosin_php_uploadscan=no

#HTTP server. Possible values: apache, nginx
webserver=apache
apache_mpm=auto
apache_ver=2.4
What is DA using to detect the Apache version?
 
Last edited:

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,987
Hello,

Just checked the code, and DA should be looking at the apache version to determine those values.
If you have apache 2.4.9 or newer, it would fill HAVE_PHP1_FPM.
Older versions of apache would fill HAVE_PHP1_FPM_OLD.

As you say you are using 2.4.10, I'm guessing the version check is probably seeing 2.4.1 or something like that.
I'll check over the DA code shortly to confirm that.

John
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hello,

Just checked the code, and DA should be looking at the apache version to determine those values.
If you have apache 2.4.9 or newer, it would fill HAVE_PHP1_FPM.
Older versions of apache would fill HAVE_PHP1_FPM_OLD.

As you say you are using 2.4.10, I'm guessing the version check is probably seeing 2.4.1 or something like that.
I'll check over the DA code shortly to confirm that.

John
But how do you get the Apache version?
I'm wondering if the detection breaks when hosts are using "ServerTokens Prod"
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,987
Hello,

1) check your errortaskq.log for this error, in case it's not being found:
Code:
errorLog_debug(100, "Apache::apache_equal_or_newer: Apache version is not loaded: %d.%d.%d", apache_major, apache_minor, apache_patch);
2) DA grabs the version like this:
Code:
/usr/sbin/httpd -v
looking at the code, it might be runnng as "nobody", so if your /usr/sbin/httpd binary can't be run as nobody, that may be the issue. Set it to 755.

John
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hello,

1) check your errortaskq.log for this error, in case it's not being found:
Code:
errorLog_debug(100, "Apache::apache_equal_or_newer: Apache version is not loaded: %d.%d.%d", apache_major, apache_minor, apache_patch);
2) DA grabs the version like this:
Code:
/usr/sbin/httpd -v
looking at the code, it might be runnng as "nobody", so if your /usr/sbin/httpd binary can't be run as nobody, that may be the issue. Set it to 755.

John
1) Yep, I see tons of these
Code:
2014:08:04-07:35:51: Apache::apache_equal_or_newer: Apache version is not loaded: 0.0.0
2) But according to your instrucions, the httpd binary doesn't seem to be the issue
Code:
# su -m nobody -c '/usr/sbin/httpd -v'
Server version: Apache/2.4.10 (Unix)
Server built:   Aug  4 2014 02:57:43

# la /usr/sbin/httpd
-rwxr-xr-x  1 root  wheel     2M Aug  4 02:57 /usr/sbin/httpd
 
Last edited:

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,987
Looking over the code, the Apache is version read only happens if:
1) The CB options.conf is able to be read in as root
2) The custombuild= variable in the options.conf is set to 2.0 or higher
3) The directadmin.conf "nginx" variable is not set to 1, eg:
Code:
cd /usr/local/directadmin
./directadmin c | grep nginx
where you'd need to see 0.

I've just run it on our test boxes, but wasn't able to get that "Apache version is not loaded" error...
If the issue persists, I may need to check it over on the box, as it would be a setting or DA code option, easier determined via debug.

John
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Looking over the code, the Apache is version read only happens if:
1) The CB options.conf is able to be read in as root
2) The custombuild= variable in the options.conf is set to 2.0 or higher
3) The directadmin.conf "nginx" variable is not set to 1, eg:
Code:
cd /usr/local/directadmin
./directadmin c | grep nginx
where you'd need to see 0.

I've just run it on our test boxes, but wasn't able to get that "Apache version is not loaded" error...
If the issue persists, I may need to check it over on the box, as it would be a setting or DA code option, easier determined via debug.

John
OK, I've just checked and settings are correct, so I'll contact you to try and figure it out.
 
Last edited:
Top