Programing

open_basedir 제한이 적용됩니다.

lottogame 2020. 10. 8. 07:40
반응형

open_basedir 제한이 적용됩니다. 파일 (/)이 허용 된 경로 내에 없습니다.


내 사이트에 아바타를 업로드 할 때이 오류가 발생합니다. 나는 전에 그것을 얻은 적이 없으며 최근 에이 오류가 발생하기 시작하도록 변경된 사항이 없습니다.

Warning: is_writable() [function.is-writable]: 
open_basedir restriction in effect. 
File(/) is not within the allowed path(s):

PHP 구성에서 open_basedir설정수정합니다 ( 런타임 구성 참조 ).

open_basedir설정은 주로 특정 사용자의 PHP 스크립트가 다른 사용자 계정의 파일에 액세스하지 못하도록 방지하는 데 사용됩니다. 따라서 일반적으로 자신의 계정에있는 모든 파일은 자신의 스크립트로 읽을 수 있어야합니다.

.htaccessPHP가 Linux 시스템에서 Apache 모듈로 실행되는 경우 를 통한 예제 설정 :

<DirectoryMatch "/home/sites/site81/">
    php_admin_value open_basedir "/home/sites/site81/:/tmp/:/"
</DirectoryMatch>

호스팅 계정에서 open_basedir 설정을 수정하고 none으로 설정합니다. Plesk / cPanel의 'PHP 설정'영역에서 제공된 open_basedir 설정을 찾으십시오. 거기에 주어진 드롭 다운에서 '없음'으로 설정하십시오. 나는 그들을 Plesk 패널 사진에서 보여 주었다.

여기에 이미지 설명 입력 여기에 이미지 설명 입력


이 오류를 해결하려면 httpd.conf 파일을 편집해야합니다. apache2handler 섹션 지시자 서버 루트의 phpinfo에서 볼 수 있기 전에. 예를 들어, 제 경우에는 이런 식으로-/ etc / httpd / httpd.conf. httpd.conf 파일을 열고 open_basedir 매개 변수에 대한 언급을 찾으십시오. 그리고 없음으로 설정하십시오. ( php_admin_value open_basedir 없음 )


For me the problem was bad/missing config values for the Plesk server running the whole thing. I just followed the directions here: http://davidseah.com/blog/2007/04/separate-php-error-logs-for-multiple-domains-with-plesk/

You can configure PHP to have a separate error log file for each VirtualHost definition. The trick is knowing exactly how to set it up, because you can’t touch the configuration directly without breaking Plesk. Every domain name on your (dv) has its own directory in /var/www/vhosts. A typical directory has the following top level directories:

cgi-bin/
conf/
error_docs/
httpdocs/
httpsdocs/
...and so on

You’ll want to create a vhost.conf file in the domain directory’s conf/ folder with the following lines:

php_value error_log /path/to/error_log
php_flag display_errors off
php_value error_reporting 6143
php_flag log_errors on

Change the first value to match your actual installation (I used /tmp/phperrors.log). After you’re done editing the vhost.conf file, test the configuration from the console with:

apachectl configtest
…or if you don’t have apachectl (as Plesk 8.6 doesn’t seem to)…

/etc/init.d/httpd configtest

And finally tell Plesk that you’ve made this change.

/usr/local/psa/admin/bin/websrvmng -a

If you're running this with php file.php. You need to edit php.ini Find this file:

: locate php.ini
/etc/php/php.ini

And append file's path to open_basedir property:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/run/media/andrew/ext4/protected


The path you're refering to is incorect, and not withing the directoryRoot of your workspace. Try building an absolute path the the file you want to access, where you are now probably using a relative path...


if you have this kind of problem with ispconfig3 and got an error like this

open_basedir restriction in effect. File(/var/www/clients/client7/web15) is not within the allowed path(s):.........

To solve it (in my case) , just set PHP to SuPHP in the Website's panel of ispconfig3

Hope it helps someone :)


I had this problem @ one of my wordpress sites after updating and/or moving :)

Check in database table 'wp_options' the 'upload_path' and edit it properly...


If you are running a PHP IIS stack and have this error, it is usually a quick permission fix.

If you administer the windows server yourself and have access, try this FIRST:

Navigate to the folder that is giving you grief on writing to and right click it > open properties > security.

See what users have access to the folder, which ones have read only and which have full. Do you have a group that is blocking write?

The fix will be specific to your IIS setup, are you using Anonymous Authentication with specific user IUSR or with the Application Pool identity?

At any rate, you are going to end up adding a new full write permission for one of IUSR, IIS_IUSRS, or your application pool identity - like I said, this is going to vary depending on your setup and how you want to do it, you can go down the google rabbit hole on this one (one such post - IIS_IUSRS and IUSR permissions in IIS8) For me, i use anon with my app pool identity so i can get away with MACHINE_NAME\IIS_IUSRS with full read/write on any temp or upload folders.

I do not need to add anything extra to my open_basedir = in the php.ini.


In addition to @yogihosting's answer, if you are using DirectAdmin, then follow these steps:

  1. Go to the DirectAdmin's login page. Usually, its port is 2222.
  2. Login as administrator. Its username is admin by default.
  3. From the "Access Level" on the right panel, make sure you are on "Admin Level". If not, change to it.
  4. From the "Extra Features" section, click on "Custom HTTPD Configurations".
  5. Choose the domain you want to change.
  6. Enter the configurations you want to change in the textarea at the top of the page. You should consider the existing configuration file and modify values based on it. For example, if you see that open_basedir is set inside a <Directory>, maybe you should surround your change in the related <Directory> tag:

    <Directory "/path/to/directory">
        php_admin_value open_basedir none
    </Directory>
    
  7. After making necessary changes, click on the "Save" button.

  8. You should now see your changes saved to the configuration file if they were valid.

There is another way of editing the configuration file, however:

Caution: Be careful, and use the following steps at your own risk, as you may run into errors, or it may lead to downtime. The recommended way is the previous one, as it prevents you from modifying configuration file improperly and show you the error.

  1. Login to your server as root.
  2. Go to /usr/local/directadmin/data/users. From the listed users, go to one related to the domain you want to change.
  3. Here, there is an httpd.conf file. Make a backup from it:

    cp httpd.conf httpd.conf.back
    
  4. Now edit the configuration file with your editor of choice. For example, edit existing open_basedir to none. Do not try to remove things, or you may experience downtime. Save the file after editing.

  5. Restart the Apache web server using one of the following ways (use sudo if needed):

    httpd -k graceful
    apachectl -k graceful
    apache2 -k graceful
    
  6. If your encounter any errors, then replace the main configuration file with the backed-up file, and restart the web server.

Again, the first solution is the preferred one, and you should not try the second method at the first time. As it is noted in the caution, the advantage of the first way is that it prevents saving your bad-configured stuff.

Hope it helps!


Just search

open_basedir =

in php.ini and disable it. That's the simplest solution to solve this issue.

Before Changes open_basedir =

After Changes ;open_basedir =

추신-변경 후 서버를 다시 시작하는 것을 잊지 마십시오.

즐겨 ;)

참고 URL : https://stackoverflow.com/questions/1846882/open-basedir-restriction-in-effect-file-is-not-within-the-allowed-paths

반응형