{"id":1308,"date":"2011-03-26T11:43:57","date_gmt":"2011-03-26T15:43:57","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1308"},"modified":"2013-03-20T08:43:56","modified_gmt":"2013-03-20T12:43:56","slug":"how-to-enable-allow_url_fopen-for-a-single-domain-on-a-cpanel-server","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-enable-allow_url_fopen-for-a-single-domain-on-a-cpanel-server","title":{"rendered":"How to enable allow_url_fopen for a single domain on a cPanel server?"},"content":{"rendered":"<p><strong>The way to enable allow_url_fopen on a phpsuexec and a non-phpsuexec server is different.<\/strong> To enable allow_url_fopen server wide is a security risk, however, you can turn it ON for a single domain incase it is required.<\/p>\n<p>Here how it needs to be done.<\/p>\n<ul>\n<li><span style=\"text-decoration: underline;\"><span style=\"color: #0000ff;\"><strong>On a non phpsuexec server:<\/strong><\/span><\/span><\/li>\n<\/ul>\n<p>Goto the \/usr\/local\/apache\/conf\/ directory,<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># cd \/usr\/local\/apache\/conf\/userdata<\/span><\/pre>\n<\/blockquote>\n<p>create a &#8216;userdata&#8217; directory if not there and then create a directory with the accounts username inside it. Finally, you have to create a file allowurl.conf in the newly created directory.<\/p>\n<p>The complete path should look like:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># pico \/usr\/local\/apache\/conf\/userdata\/&lt;username&gt;\/allowurl.conf<\/span><\/pre>\n<\/blockquote>\n<p>and add the following to the file<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">&lt;IfModule mod_php5.c&gt; \u00a0<\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">php_admin_value allow_url_fopen On <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">php_admin_value allow_url_include On <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">&lt;\/IfModule&gt; <\/span><\/pre>\n<\/blockquote>\n<p>Now, edit the Apache configuration file and scroll down to the VirtualHost entry of the domain. Include the path of the above created file in it, as shown below:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">Include \"\/usr\/local\/apache\/conf\/userdata\/&lt;username&gt;\/allowurl.conf\"<\/span><\/pre>\n<\/blockquote>\n<p>Save the file and rebuild the apache configuration<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># \/usr\/local\/cpanel\/bin\/apache_conf_distiller --update <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\"># \/usr\/local\/cpanel\/bin\/build_apache_conf <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\"># \/scripts\/restartsrv httpd<\/span><\/pre>\n<\/blockquote>\n<p>This will enable allow_url_fopen for that domain.<\/p>\n<ul>\n<li><span style=\"text-decoration: underline;\"><span style=\"color: #0000ff;\"><strong>On a PhpSuExec Or SuPHP server:<\/strong><\/span><\/span><\/li>\n<\/ul>\n<p>To enable allow_url_fopen on a SuPHP\/PHPSuExec enabled server, copy the server side php.ini OR create a new one under the public_html directory of the domain (OR in the directory where you want to enable allow_url_fopen) i.e.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># cp \/usr\/local\/lib\/php.ini \/home\/&lt;username&gt;\/public_html\/<\/span><\/pre>\n<\/blockquote>\n<p>and edit the new php.ini to enable allow_url_fopen directive:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">allow_url_fopen = On<\/span><\/pre>\n<\/blockquote>\n<p>Save the file and this is it.<\/p>\n<p>BTW, replace &#8220;&lt;username&gt;&#8221; with the actual username of the domain wherever stated above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The way to enable allow_url_fopen on a phpsuexec and a non-phpsuexec server is different. To enable allow_url_fopen server wide is a security risk, however, you can turn it ON for a single domain incase it is required.<br \/>\nHere how it needs to be done.<\/p>\n<p>On a non phpsuexec server:<\/p>\n<p>Goto the \/usr\/local\/apache\/conf\/ directory,<\/p>\n<p># cd \/usr\/local\/apache\/conf\/userdata<\/p>\n<p>create a &#8216;userdata&#8217; directory if not there and then create a directory with the accounts username inside it. Finally, you have to create a file allowurl.conf in the newly created directory.<br \/>\nThe complete path should look like:<\/p>\n<p># pico [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1204,1207,1205,1206,1208],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1308"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=1308"}],"version-history":[{"count":11,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1308\/revisions"}],"predecessor-version":[{"id":2260,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1308\/revisions\/2260"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}