Koozali.org: home of the SME Server
Obsolete Releases => SME Server 8.x => Topic started by: genisys on July 26, 2012, 11:24:37 PM
-
Hello all -
I recently upgraded to SME 8. The upgrade went very smoothly and everything has been working fine, except today I found out that when people go to our website to submit a request form to us, it fails with this error:
Forbidden
You don't have permission to access /php5-cgi/php/Request/process.php on this server.
I think possibly that php5-cgi is not installed and I should do:
yum --enablerepo=smecontribs install smeserver-php5-cgi
signal-event post-upgrade ; signal-event reboot
The notes for this HOWTO says it's for testing only and I really don't know if this is the solution or not, so I'm a bit hesitant doing anything without knowing it's safe. I also do not have any PHP experience. Any help would be appreciated.
-
you don't need php5-cgi on SME8, you already have php5.3, php5-cgi is bugged and dangerous (search the forums)
I suggest you to modify your form/php page: if you are not able, hire someone
-
Find the template fragment that is inserting a php5-cgi handler into /etc/httpd/conf/httpd.conf, and just take out the reference.
With a default php5-cgi install, there's a db variable per-ibay that enables php5-cgi - you could check your ibays (db accounts show |less -S - then search for 'php5'). If you have an ibay set to use php5-cgi, delete the db value, expand httpd.conf, and restart httpd-e-smith.
If you setup the site using php5-cgi using sme sitemaker, there will be a custom template fragment in /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf that says something like "AddHandler php5-cgi .php" - just delete that line, expand httpd.conf, and restart httpd-e-smith.
It may be possible to use "AddHandler" in .htaccess -- if so (and if you haven't found anything about php5 yet) you'll need to check in the .htaccess file in the folder serving the failing site.
-
Thanks for the responses.
1. I ran this to shut off php5 on the Primary ibay:
db accounts setprop Primary php5 no
signal-event ibay-modify Primary
2. In /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf, I see two files:
80php5-cgi
90Primary
80php5-cgi has contents:
ScriptAlias /php5-cgi /usr/bin/php5
<Directory /usr/bin/php5>
order deny,allow
deny from all
allow from all
Options ExecCGI
</Directory>
90Primary has contents:
ScriptAlias /php5-cgi /usr/bin/php5
<Directory /usr/bin/php5>
order deny,allow
deny from all
allow from all
Options ExecCGI
</Directory>
If I remove the "AddHandler" line from 90Primary, will this fix the issue even though there are several other references to php5? Are we needing to change all the references of /usr/bin/php5 (which doesn't exist) to /usr/bin/php (which does exist)?
Correction:
90Primary contents:
<Directory /home/e-smith/files/ibays/Primary/html>
AddHandler php5-cgi .php
Action php5-cgi /php5-cgi/php
</Directory>
-
Remove both custom templates, and reconfigure the system (via console option, or using signal-event if you know how).
-
Hi genisys,
You absolutely don't want PHP5-cgi running on your system (see threads in the forum). As you are now using SME 8 which includes PHP 5.3 you will want to remove PHP 5-cgi.
If you installed using the following how-to:
http://wiki.contribs.org/PHP5 (http://wiki.contribs.org/PHP5)
then you will need to remove it using either:
yum erase smeserver-php5-cgi
- or -
rpm -e php5-cgi*
... depending on the package you installed in the first place (the above wiki page will help).
Once you've done this remove the custom templates you found and update the SME account database with:
db accounts setprop ibayname php5 no
signal-event ibay-modify ibayname
for each iBay on your system.
Lastly issue:
signal-event post-upgrade
signal-event reboot
You should now have a system clean of PHP 5-cgi.
-
genisys:
If you end up with a concise list of the steps needed to remove php5-cgi after an upgrade from 7.x to 8.x, please add them to one or both of these wiki pages:
- http://wiki.contribs.org/PHP5
- http://wiki.contribs.org/SME_Server_8#Additional_steps_and_potential_changes
-
PHP5 is not actually installed on the new server, so I did this:
1. I deleted the two custom templates in /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf:
80php5-cgi
90Primary
2. I ran this to shut off php5 on the Primary ibay:
db accounts setprop Primary php5 no
signal-event ibay-modify Primary
3. Then ran:
signal-event post-upgrade
signal-event reboot
Now when I go to the form (the only part of the website which seems to call PHP and isn't working), I submit the form and get a blank page. Is there a config file that I have to change so this page uses php5.3?
-
Do this:
expand-template /etc/httpd/conf/httpd.conf
service httpd-admin restart
service httpd-e-smith restart
And then try again. If you're still getting a blank page go have a look in the messages log in the server manager.
-
After expanding httpd.conf, I was still getting a blank page and the message log showed:
Jul 30 08:54:54 email httpd: PHP Warning: fopen(admin/data.dat) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in /home/e-smith/files/ibays/Primary/html/Request/process.php on line 63
Jul 30 08:54:54 email httpd: PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/e-smith/files/ibays/Primary/html/Request/process.php on line 95
Jul 30 08:54:54 email httpd: PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /home/e-smith/files/ibays/Primary/html/Request/process.php on line 98
I went to line 63 of process.php and tracked down the file that this was writing too. Somehow the permissions were changed, I don't know how that could have happened. It sounds like removing the old templates, turning off php5 on the ibay and expanding httpd.conf were all necessary steps, however I also had this permission issue that needed to be dealt with.
I appreciate all of your help, our form is now working again! :-)