php 在godaddy共享主机linux中如何访问php.ini文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16140917/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:36:06  来源:igfitidea点击:

How to access the php.ini file in godaddy shared hosting linux

php

提问by MudMan23

I have a web, and running well on my localhost.

我有一个网络,并且在我的本地主机上运行良好。

After I Upload on my godaddy hosting, My web got a bug. the conclusions is, I MUST change the memory_limit on the php.ini file, BUT cant find php.ini on FTP manager.

在我的 Godaddy 主机上上传后,我的网站出现错误。结论是,我必须更改 php.ini 文件上的 memory_limit,但在 FTP 管理器上找不到 php.ini。

I have tried to:

我试图:

  • Find the way for change to the Classing FTP manager.
  • Create / upload php.ini file from local and not work.
  • 找到更改分类 FTP 管理器的方法。
  • 从本地创建/上传 php.ini 文件,但不起作用。

My Questions is : How I can Fix this? I Must change php.ini file. does anyone have experience like me?

我的问题是:我该如何解决这个问题?我必须更改 php.ini 文件。有没有人和我一样的经历?

回答by Yogesh Suthar

Create php.inifile with your desired setting and upload it in your root folder of server. It will take effect with this new setting.

php.ini使用所需的设置创建文件并将其上传到服务器的根文件夹中。它将在此新设置下生效。

You can't edit the php.inifile of godaddyserver, but you can upload your own copy of your php.iniwith your new setting.

您无法编辑服务器php.ini文件godaddy,但您可以php.ini使用新设置上传您自己的副本。

This new setting will be available only to you. Other websites will not be affected with this new setting.

此新设置仅供您使用。其他网站不会受到此新设置的影响。

Previously I faced the same issue, but after doing this my problem was resolved.

以前我遇到过同样的问题,但在这样做之后我的问题就解决了。

回答by Papouche Guinslyzinho

Procedures:

程序:

  • Go to your CPanel
  • Select PHP version
  • Click on the link Switch to PHP options
  • Edit your configuration
  • don't forget to click save
  • 转到您的CPanel
  • 选择PHP 版本
  • 单击链接切换到 PHP 选项
  • 编辑您的配置
  • 别忘了点击保存

enter image description here

在此处输入图片说明

You can also follow this screencast

您也可以关注此截屏视频

https://www.youtube.com/watch?v=tdUlIkZcOe0

https://www.youtube.com/watch?v=tdUlIkZcOe0

回答by kakoma

As pointed out by @Jason, for most shared hosting environments, having a copy of php.ini file in your public_html directory works to override the system default settings. A great way to do this is by copying the hosting company's copy. Put this in a file, say copyini.php

正如@Jason 指出的那样,对于大多数共享托管环境,在 public_html 目录中拥有 php.ini 文件的副本可以覆盖系统默认设置。一个很好的方法是复制托管公司的副本。把它放在一个文件中,比如 copyini.php

<?php
  system("cp /path/to/php/conf/file/php.ini  /home/yourusername/public_html/php.ini");
?>

Get /path/to/php/conf/file/php.ini from the output of phpinfo(); in a file. Then in your ini file, make your amendments Delete all files created during this process (Apart from php.ini of course :-) )

从phpinfo()的输出中获取/path/to/php/conf/file/php.ini;在一个文件中。然后在您的 ini 文件中,进行修改 删除在此过程中创建的所有文件(当然 php.ini 除外 :-) )

回答by chandresh_cool

To check whether your php.inifile takes effect, open a plain text editor and create a file called phpinfo.php. Insert the following line:

要检查您的php.ini文件是否生效,请打开纯文本编辑器并创建一个名为phpinfo.php. 插入以下行:

<?php phpinfo(); ?>

Save this file to the root of your Web site and then browse to yourdomain.com/phpinfo.php to test the settings.

将此文件保存到您网站的根目录,然后浏览到 yourdomain.com/phpinfo.php 以测试设置。

回答by Arslan Ramay

Create a new php.inifile with your desired settings and upload it to public_htmlfolder of your Godaddy Hosting Account.

使用您想要的设置创建一个新的php.ini文件并将其上传到您的 Godaddy 托管帐户的public_html文件夹。

By default, Godaddydoesn't allow to edit it's existing php.inifile. However, you can always upload your own copy of your php.ini file with your own settings.

默认情况下,Godaddy不允许编辑它现有的php.ini文件。但是,您始终可以使用自己的设置上传自己的 php.ini 文件副本。

Below is an example of a simple php.ini file with some custom values:

下面是一个带有一些自定义值的简单 php.ini 文件示例:

max_execution_time 600
memory_limit 128M
post_max_size 32M
upload_max_filesize 32M

回答by mdg

if you don't have a good copy of your php5.inifile in your home directory (a predicament that I recently found myself in), you'll need to follow a little multi-step process to make your changes.

如果您php5.ini的主目录中没有您的文件的良好副本(我最近发现自己陷入了困境),您将需要遵循一些多步骤的过程来进行更改。

  1. Create a little code snippet to look at the output of the phpinfo()call. This is simple, and there are multiple web-sites that describe this process.

  2. Examine the output of phpinfo()for the row which contains Configuration File (php.ini) Path. Mine was in /usr/local/lib, but your's may be a different path (depends on hosting level purchased).

  3. GoDaddy will NOT simply copy this file into your home directory for you --as silly as that sounds! But, you can write a little php program to copy this php.ini file into your home directory. The guy at https://www.jabari-holder.com/blog/how-to-get-godaddys-php5-ini-file/has a drop-box with this code snippet, if you care to use it. Just take care to modify two things:

    • a. change the path you read 'from' to match the path you uncovered in Step 2.

    • b. change the output file-name to something of your choosing. You're going to re-name this file in a later step anyway. Let's call our copied file Foo.ini(but it can be anything).

  4. Rename Foo.inito .user.ini(for most GoDaddy account types).

  1. 创建一个小代码片段来查看phpinfo()调用的输出。这很简单,并且有多个网站描述了这个过程。

  2. 检查phpinfo()包含 的行的输出Configuration File (php.ini) Path。我的是/usr/local/lib,但你的可能是不同的路径(取决于购买的主机级别)。

  3. GoDaddy 不会简单地将这个文件复制到您的主目录中——这听起来很愚蠢!但是,您可以编写一个小 php 程序来将此 php.ini 文件复制到您的主目录中。在这家伙 https://www.jabari-holder.com/blog/how-to-get-godaddys-php5-ini-file/有一个下拉框,此代码段,如果你愿意使用它。只需注意修改两件事:

    • 一种。更改您从“从”读取的路径以匹配您在第 2 步中发现的路径。

    • 湾 将输出文件名更改为您选择的内容。无论如何,您将在稍后的步骤中重命名此文件。让我们调用我们复制的文件Foo.ini(但它可以是任何东西)。

  4. 重命名Foo.ini.user.ini(对于大多数 GoDaddy 帐户类型)。

回答by Bonedancer

Septiyo,

塞蒂约,

You need to create your own php5.ini file and upload it to your root directory. Using GoDaddy (as I do) you do not have control over the web/conf/ folder to make any changes to their version. Be sure if you're using PHP5 to name your file php5.ini or php.ini for PHP4. Upload it to your root folder, then restart your page, then check using phpinfo() to see if the directory of your php file has changed correctly.

您需要创建自己的 php5.ini 文件并将其上传到您的根目录。使用 GoDaddy(就像我一样),您无法控制 web/conf/ 文件夹对其版本进行任何更改。请确定您是否使用 PHP5 为 PHP4 命名您的文件 php5.ini 或 php.ini。把它上传到你的根文件夹,然后重新启动你的页面,然后使用 phpinfo() 检查你的 php 文件的目录是否正确更改。

For more information, check this link out. http://www.ostraining.com/blog/coding/phpini-file/

有关更多信息,请查看此链接。 http://www.ostraining.com/blog/coding/phpini-file/

回答by Steven G

I had this exact problem with my GoDaddy account.

我的 GoDaddy 帐户确实存在这个问题。

I am running the Linux hosting with cPanel

我正在使用 cPanel运行Linux 主机

follow these steps and you should be fine if you are running the same hosting as me:

请按照以下步骤操作,如果您与我运行相同的主机,应该没问题:

first, go to you Manage Your Hosting -> Manage

首先,转到您管理您的主机 -> 管理

then you will see a section called Files, click on File Manager

然后你会看到一个名为Files的部分,点击File Manager

you can select the Document Root for: yourwebsite.comthen click GO

您可以选择文档根目录:yourwebsite.com然后单击GO

this should bring you right away in the public_htmlfolder

这应该会立即带您进入public_html文件夹

in that folder, you can add a file (by clicking the +File in top left corner), call it phpinfo.php

在该文件夹中,您可以添加一个文件(通过单击左上角的 +File),将其命名为 phpinfo.php

right click that new file, and select edit :

右键单击该新文件,然后选择编辑:

right this in it and save changes:

将其放入其中并保存更改:

<?php phpinfo(); ?>

it the same public_htmlfolder, add another file called php.ini

在同一个public_html文件夹中,添加另一个名为php.ini 的文件

edit this one too, right those lines:

也编辑这个,对那些行:

max_execution_time 600
memory_limit 128M
post_max_size 32M
upload_max_filesize 32M

now, go back to your Manage Your Hosting -> Manage, look for PHP Process

现在,回到您的Manage Your Hosting -> Manage,寻找PHP Process

click Kill Process, this will allows a refresh with your new settings. you are good to go

单击 Kill Process,这将允许刷新您的新设置。你已准备好出发

side note: you can see your new settings by navigating to yourwebiste.com/phpinfo.php

旁注:您可以通过导航到 yourwebiste.com/phpinfo.php 来查看您的新设置

回答by CrandellWS

I found a guide to reload the php5.ini file or load a new one right away. You will need to access your Godaddy hosting panel where you will find the option "system process" do a restart there and it will load the php5.ini or php.ini file right away.

我找到了一份重新加载 php5.ini 文件或立即加载新文件的指南。您将需要访问您的 Godaddy 主机面板,您会在其中找到“系统进程”选项,然后在那里重新启动,它会立即加载 php5.ini 或 php.ini 文件。

2 external guides to assist you:

2 个外部指南来帮助您:

http://support.godaddy.com/help/article/5980/managing-system-processes-on-linux-hosting-accounts

http://support.godaddy.com/help/article/5980/managing-system-processes-on-linux-hosting-accounts

http://www.studio-owens.com/blog/GoDaddy-and-Your-php-ini-File.htm

http://www.studio-owens.com/blog/GoDaddy-and-Your-php-ini-File.htm

回答by m4olivei

For some hosting accounts, I'm on Ultimate Classic Linux, the file name you need to use is .user.ini.

对于某些主机帐户,我使用的是 Ultimate Classic Linux,您需要使用的文件名是 .user.ini。