remove open_basedir restriction - .htaccess

I am running a script and i am getting the following error:
WARNING: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/Am/View/Helper/HeadScript.php) is not within the allowed path(s): (/home/1205915141/members-net/:/tmp:/usr/share/pear/) in line 198 of file /home/1205915141/members-net/public_html/library/Zend/Loader.php
I asked my host to remove the restriction but they said they wont because of security reasons. So resolved to do it my self by overriding the php.ini with an htaccess like this:
php_value open_basedir /usr/share/php/
but it wont work. Im not sure what is exactly the problem, whether the syntax or the path. Could you please give me a hand?
Thank you.

What PHP version do you use - maybe < PHP 5.3?
See http://php.net/manual/en/ini.core.php
For PHP < 5.3 this value was PHP_INI_SYSTEM, which means it can only be set from within php.ini or httpd.conf. Starting with PHP 5.3 its value is PHP_INI_ALL, so you can set it from within a htaccess file.

Related

display errors function is not showing php

I have server on centos system. Has php 7.4, apache version and also laravel project on it. And when i go to my site it gives me blank page. So i think it can't to show php error codes. I need your help.
Although your question lacks adequate information, you can achieve what you desire in two ways.
Via php.ini file
open your php.ini file and look for this line:
display_errors = off and change it to display_errors = on
Via your php file
In your php file just add these lines to the top:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Please share some more details of what you actually want to do so i can help you out ...

.htaccess not working on xampp Ubuntu 14.04

I have difficulties making my .htacces work on my Ubuntu 14.04 LTS. I know it is a hidden file and all; I've searched everywhere and people seem to have the same problem. I've made a virtual host on my machine and all. Can someone please help me ?
ErrorDocument 404 /pages/error.php?code=404
ErrorDocument 403 /pages/error.php?code=403
You need to make sure the following things are true:
You need to check what DocumentRoot is set to. When an url beginning with a slash is detected, it will try to load that file relative to the document root. (docs) The file <documentroot>/pages/error.php must thus exist.
You need to make sure that .htaccess files are allowed by the main Apache configuration. The easiest way to test this is by entering garbage into your .htaccess file, saving it and reloading a page. You'll get an internal server error if Apache reads the .htaccess file. Otherwise the page loads as expected. To enable .htaccess files, the AllowOverride directive must allow something (see next bullet point). Additionally, check in httpd.conf if AccessFileName is set to something different than .htaccess. Change it as necessary, then RESTART APACHE. (docs)
For ErrorDocument, AllowOverride must be at least set to FileInfo. See the docs. Go to your main config file (httpd.conf), probably apache/Apachex.y.z/conf/httpd.conf. Search for the <Directory ...> block that corresponds to your http root, and look around if it contains an AllowOverride directive. Add FileInfo as one of the arguments, save the file and RESTART APACHE.

WSGIPassAuthorization On directive in .htaccess

I am get issue with set WSGIPassAuthorization On directive in .htaccess.
any one can suggest how to add this variable to .htaccess ?
thank all so much.
You don't actually state what the specific error you get is when you try.
Has your Apache even been configured to allow use of .htaccess files?
Has your Apache even been configured to allow FileInfo overrides in .htaccess files?
AllowOverride FileInfo
Both would be required for WSGIPassAuthorization to work in a .htaccess file.
So please tell us what the error is you get in the browser and in the Apache error logs.
Indicate whether you have taken the steps above.

php ini settings given in .htaccess is not working

I need to use time zone PST for my application, so i have set these settings in .htaccess file of my zend project. --
php_value date.timezone "America/Los_Angeles"
But it is not being reflected in my project, when i echo the date it is showing me Indian time. What am missing in this please help me to know.
Ensure .htaccess files is of any use. It may be that your httpd is not even reading it (most likely) or it does, but ignores your php_value (less possible as it usually ends with error 500)

upload script not working after enabling suphp

My php script that uploads files in my centos - apache server was working fine.
Today I enabled suphp in server and after that script is not uploading any files.
I was used "php_flag register_globals on" in .htaccess before. But I removed that line from ".htaccess" in order to prevent 500 server error.
Pls help
After a long search and testing, I found the solution myself.
Just created a php.ini file and added a line:
register_global = on
and removed all php flags in .htaccess.
Now its working fine.
As you figured out the parameter has to be in a php.ini file and suPHP has to be instructed to read this file. More information in this answer: php.ini not being read (Debian / ISP Config)
But; If your upload script requires register_globals to be enabled it's probably badly written or outdated. You should try to avoid using register_globals since it poses a security threat. More about that here: What are register_globals in PHP?

Resources