Forums / Install & configuration / php safe mode and .htaccess

php safe mode and .htaccess

Author Message

paul bolger

Saturday 12 August 2006 11:17:43 pm

I'm trying to set up EzPublish on a remote Linux host. The host has PHP safe mode set to 'on', and I'm trying to override that with a line in .htaccess in the root directory.
My question is: How do I tell if the override is working? The installer, and phpinfo, are maintaining that safe mode is still on. Can I ignore that warning?

Paul Bolger

Łukasz Serwatka

Sunday 13 August 2006 11:20:00 pm

Hi Paul

safe_mode can be set in php.ini or httpd.conf. It will not work with .htaccess. This means that you need full access to your web server environment. You can ask also system administrator for help.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

paul bolger

Monday 14 August 2006 5:32:43 am

Hi Lukasz

Ok, if I have to ask my hosting provider to turn of safe mode for my site, is there anything else I need to ask for at the same time?
I'm a bit unclear whether the other problems mentioned in the finetune dialogue (wrong permissions for a couple of directories under /var, and inability to create or write to /tmp) would still be issues if safe mode was switched off.

BTW: do you know which files need to be deleted or replaced to take EzPublish back to the beginning of the automated installation? I've got to a point where I have a non-functioning installation and it'd be nice be able to undo it without deleting the lot and re-starting.

regards
Paul Bolger

Paul Bolger

Łukasz Serwatka

Monday 14 August 2006 5:47:34 am

Hi again,

I'm a bit unclear whether the other problems mentioned in the finetune dialogue (wrong permissions for a couple of directories under /var, and inability to create or write to /tmp) would still be issues if safe mode was switched off.

Web server needs write permissions to the eZ publish var/ directory. It is directory where are stored images, cache files, logs, etc.

You will need also permissions to upload files (images, documents, etc) via HTTP. Disable safe_mode should help. Ask administrator about this.

BTW: do you know which files need to be deleted or replaced to take EzPublish back to the beginning of the automated installation? I've got to a point where I have a non-functioning installation and it'd be nice be able to undo it without deleting the lot and re-starting.

Remove all files from the settings/override/ also directories from settings/siteaccess/ which where created by you or your installation wizard (keep only admin and setup, that 2 comes with default distro).

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

paul bolger

Tuesday 15 August 2006 2:16:42 am

Hi Lukasz

I asked my hosting company to turn off safe mode for my domain, and they... added a line to the .htaccess file in the root directory. Can you explain why this doesn't work for EzPublish while it (apparently) does for other PHP apps?
I'm not trying to be smart, I just need to be able to justify myself if I go back to them with a special request.

Paul Bolger

Paul Bolger

Łukasz Serwatka

Tuesday 15 August 2006 2:22:28 am

Can you please provide link to the phpinfo and check what line was add to your .htaccess?

Create new file info.php with code inside:

<?php phpinfo(); ?>

Then run it in your web browser. Check safe_mode for local and global setting.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

paul bolger

Tuesday 15 August 2006 4:46:32 pm

Hi Lukasz

I tried running php.info again and guess what: 'safe mode = off"

So it seems that adding php_admin_flag safe_mode Off (this is what the host helpdesk said they added) to .htaccess has fixed the problem, although I'm a little confused as to where it's been added as I can't see it in any of the directories visible to me.

Anyhow, to clarify for anyone else reading, .htaccess overriding of php safe mode will display in php.info - if it's showing as 'safe mode = on' you need to try something else.

Thanks for your patience.

Paul Bolger

Paul Bolger

Łukasz Serwatka

Tuesday 15 August 2006 11:11:41 pm

I think they set this flag in the httpd.conf. That setting can be only change in the php.ini or in httpd.conf. If user could disable safe_mode via .htaccess then whole idea of safe_mode obviously does not make sens.

More about safe_mode
http://no.php.net/manual/en/features.safe-mode.php#ini.sect.safe-mode

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog