Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having real issues in a project that I'm working on with scripts running from HTTP but not from HTTPS.

The areas that this comes up in, is when permissions are needed either to execute a command on the server via exec() or passthru(), or when the script is trying to open a file using fopen.

When using HTTPS the exec() and passthru() functions return a 127 error, which I believe is a command not found error and the fopen will throw a Permission denied exception.

On top of this I can't really understand the setup on the server. I'm sure they're running apache, but I can't see it in the /etc/group file. I think this is because they have plesk (there is a psacln group).

I really need to sort this out because it is sucking up days and days of time. But more than that, I really want to understand what is going on here and why.

Can anyone tell me if it should be possible to run these scripts from HTTPS?

The OS is Ubuntu and the PHP version is 5.2.4

Many thanks

More Info on Current Setup

httpd.conf is blank

Listen 80

<IfModule mod_ssl.c>
    Listen 443

// envvars
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/

// part of apache2.conf where all the configuration seems to be
# These need to be set in /etc/apache2/envvars

What does it mean for the apache_run_user and apache_run_group to be set to www-data? Should this be set to something else? - apache, or psacln?


I changed the permissions of the directory that my forms live in to 777 and the scripts that use fopen now work even from HTTPS.

Obviously I should need to do this and it is BAD. Should I be looking at what group PHP belongs to? Why would this differ from HTTP to HTTPS?

share|improve this question

In my opinion it isn't a matter of groups. The "group" with witch the file is accessed is always the "www-data" group from Apache.

The only possibility I see, why you have to "chmod 777" all the files when executing the script via https, is a misconfiguration of your https vhost.

Maybe there is a -directive in your http vhost file which allows this kind of access and differs from your https -directive.

A configuration snippet would help.

share|improve this answer
Hi. The vhost.conf file (if that's the one you mean) located at /var/www/vhosts/mydomain/conf/vhosts.conf only has a couple of lines: <Directory /var/www/vhosts/> php_admin_value safe_mode off php_admin_value open_basedir none </Directory> I'm not sure that's too helpful for you. – Joe Sep 20 '11 at 12:29
aren't there different vhost files for http and https? – Subito Sep 20 '11 at 12:31
No. There's another vhost.conf in /var/www/vhosts/mydomain/httpdocs with exactly the same configuration, but there is not a file in httpSdocs. – Joe Sep 20 '11 at 14:12
Maybe there should be one. Try to contact your provider about this issue, I think it has something to do with the non-existent vhost declaration for https. – Subito Sep 20 '11 at 14:18
chmod 777: nonononono! Never ever run chmod 777. It is practically never required! Not even for "testing purposes". If the file is readable, then it's readable. If it's writable by the user or group that need to write to it, then it's writable. There is absolutely zero need to give everyone write permissions, and forgetting to chmod it back to something sane is exactly how multinationals get hacked. Just don't do it. Ever. I wrote an introduction of Unix permissions. Please read it! – Carpetsmoker Mar 13 at 6:01

Do you have access to Plesk? If so go to the domain, then Web Hosting Settings and see if "Use a single directory for housing SSL and non-SSL content" is checked. If not, then https will have a different DocumentRoot (probably httpsdocs).

SSL has a different config file: /var/www/vhosts/mydomain/conf/vhosts_ssl.conf.

After editing either conf file, be sure to:

sudo /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=mydomain
sudo apache2ctl reload


Also FYI, directives in the conf files in mydomain/conf override Plesk's config for the vhost, so there are directives that you cannot see in these files that affect the vhost.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.