Ubuntu – PHP scripts running via HTTP, but not via HTTPS

permissionsPHPUbuntu

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

//ports.conf
Listen 80

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

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

// part of apache2.conf where all the configuration seems to be
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

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?

Update

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?

Best Answer

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.

Related Topic