简体   繁体   English

PHP文件在一种设置中起作用,但在另一种设置中不起作用

[英]PHP Files work in one setup but not in another

I've recently made a new Fedora setup, consisting of Fedora 19, Oracle 11g, Apache 2.4.6, and PHP 5.5.4 (afaik). 我最近做了一个新的Fedora设置,包括Fedora 19,Oracle 11g,Apache 2.4.6和PHP 5.5.4(afaik)。 My objective is to migrate an existing PHP setup from one aging PC to this new one. 我的目标是将现有的PHP设置从一台老化的PC迁移到这台新的PC。 As far as I know, I have everything correct, sans PEAR*. 据我所知,我一切都正确,没有梨*。

Now, I've been able to create an info.php page with the following line of code: 现在,我已经能够使用以下代码行创建一个info.php页面:

<?PHP
 phpinfo();
?>

That page works fine. 该页面工作正常。 (localhost/info.php) (本地主机/ info.php的)

Upon copying over my folder (full of PHP stuff), and trying to access it (via: localhost/hrweb/login.php), all I get is Internal Error in Server . 复制完我的文件夹(充满PHP东西)并尝试访问它(通过:localhost / hrweb / login.php)后,我得到的只是Server中的Internal Error

It should be noted that said webpages work fine on the other setup. 应当指出的是,所述网页在其他设置上可以正常工作。

I'm not sure how to proceed. 我不确定如何进行。 Can anyone suggest where else I could look to solve this? 谁能建议我可以找到其他解决方案? Could there be a setting somewhere I missed? 我错过了某个地方吗?

I'm using Konqueror, if that means anything, as it comes by default on Fedora 19. 我正在使用Konqueror(如果有任何意义),因为它在Fedora 19上默认出现。

*- I've seen instances of the webpage running fine (at least, the Log In Page) on a system without PEAR - which I'm not familiar with - so I'm not sure if the lack of PEAR is causing this issue. *-我已经看到网页实例在没有PEAR的系统上运行良好(至少是登录页面)(我不熟悉),因此我不确定是否缺少PEAR导致了此问题。 At the very least, it should display the Log In Page. 至少,它应该显示“登录页面”。

Additional Info: 附加信息:

  • The entire folder has been set to permissions 775, and the owner:group set to apache:apache 整个文件夹已设置为权限775,并且owner:group设置为apache:apache

Error 500 - Internal server error 错误500-内部服务器错误

Is an error message, when a user tries to access your Apache based dynamic PHP application. 当用户尝试访问基于Apache的动态PHP应用程序时,出现错误消息。

To solve this problem you need to take help of log files located at following location: 要解决此问题,您需要获得位于以下位置的日志文件的帮助:

  • /var/log/message 在/ var /日志/消息
  • /var/log/httpd/error_logs 在/ var /日志/的httpd / error_logs

This error only occurs because of web server software. 仅由于Web服务器软件而发生此错误。 However after looking through logs you may not find many details. 但是,在浏览日志后,您可能找不到很多详细信息。 This problem may be caused by: 此问题可能是由于:

  • An invalid directive in an .htaccess or other config file .htaccess或其他配置文件中的无效指令
  • A malformed PHP CGI script 格式错误的PHP CGI脚本
  • Limitation imposed by file system and server software (for example PHP log file size set to 10Mb) 文件系统和服务器软件施加的限制(例如,PHP日志文件大小设置为10Mb)
  • Missing php.ini (or cannot read php.ini file) 缺少php.ini (或无法读取php.ini文件)

Most likely you don't have all necessary Apache modules installed. 您很可能没有安装所有必需的Apache模块。 See you .htaccess and make sure that Apache has all modules installed required by your software and your Apache new configuration. 请参阅.htaccess ,并确保Apache已安装软件和Apache新配置所需的所有模块。

Depending on your server configuration and Apache version you're using, you can basically check it running with -M switch: 根据您的服务器配置和所使用的Apache版本,基本上可以使用-M开关检查其运行情况:

httpd -M

It will tell you which modules are built-in or shared that you have. 它会告诉您哪些模块是内置的共享的

If you're running PHP as mod_php then you could also check Apache avalable modules running: 如果您以mod_php运行PHP ,则还可以检查Apache可用模块的运行情况:

print_r( apache_get_modules() );

  • In addition: 此外:
    1. Check that you have correct file paths set, with require/include directives; 使用require/include指令检查是否设置了正确的文件路径
    2. Check that you have correct folders/files permissions , To debug the problem, run inside of your home directory: ls -lsa . 检查您是否具有正确的文件夹/文件权限 ,要调试问题,请在主目录中运行: ls -lsa After you will be able to see the owner/group settings. 之后,您将可以看到所有者/组设置。 In case it's incorrect, you could fix it by running: chown -R correctOwner:correctGroup * 如果不正确,可以通过运行以下命令来修复它: chown -R correctOwner:correctGroup *

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM