Server 500: This page isn’t working - php

I am new web server and web hosting. I created a Fedora 28 web server to host my own website, and to learn the ins and outs of web serving. The apache is working, http://<hostname>. I even created a phpinfo() file, which works also; http://<hostname>/info.php. To test my directory access I added an info.php to that as well; http://<hostname>/mywebdir/info.php. However, in the same directory level I have a general index.php file, which is my controller for said project; http://<hostname>/mywebdir/index.php but it gets the "This page isn’t working is currently unable to handle this request.
HTTP ERROR 500".
security context: unconfined_u:object_r:httpd_sys_content_t:s0
I have edited the properties on this file to be executable. What could be blocking this file? Again I am just learning.

Clearing all fatal errors will fix this issue. I forgot to install the pear package manager which threw fatal errors in my project.

Related

When trying to browse the index.php page on brand new Grav install on IIS i only get a "http error 500" page

I am trying to use Grav CMS (https://getgrav.org/) on a Windows Server 2012 R2 with IIS. I unzip the grav core package and have moved it to my folder named grav in the following location: C:\inetpub\wwwroot\
When i try to launch the site i get the following message to come up:
This page isn't working
localhost is currently unable to handle this request.
http error 500
If i add a couple of echo outputs in the index.php file then i do get those to appear until the following lines of code that never seem to run and may be what is causing my issue:
// Process the page
try {
$grav->process();
} catch (\Exception $e) {
$grav->fireEvent('onFatalException', new Event(array('exception' =>
$e)));
throw $e;
}
This part seems to be what is causing the page to not load which i dont understand why it is doing so. I can make additional pages and put php code into them and i can render the page without issues.
I am at a loss right now because i made sure all the php modules are enabled and php is installed. I also installed php for IIS and made sure i did the URL rewrite for the htaccess file to a web.config file per the instructions.
Thank you very much for the help.
Figured it out. So I am using PHP 7 and found that a log gets created in the following location C:\Windows\Temp\PHP70x64_errors.log. Once I found that I found I had the following error message:
Uncaught RuntimeException: Opening file for writing failed on error in C:\inetpub\wwwroot\grav\vendor\rockettheme\toolbox\File\src\File.php:198
So this led me to look at the permission page on the Grav site and all of the fixes were for Linux and not Windows but this line caught my eye: The important thing to understand is that there is a potential issue if the user you use to edit your files on the file-system is different from the user that PHP runs under.
So I then needed to find out what user PHP was running under so I then created a test.php file and added the following:
<?php
echo exec('whoami');
?>
Which returned for me nt authority\iusr. So I then gave my whole Grav folder permissions for this user (probably could have just given it write) and voila it worked.

IIS Plesk Shared Hosting Wordpress started to give 500.50 error out of nowhere for some files

I have my Wordpress on Shared IIS hosting using Plesk. Today, just by itself, some of my uploaded files started to give this error:
HTTP Error 500.50 - URL Rewrite Module Error. The page cannot be
displayed because an internal server error has occurred.
Most likely causes: IIS received the request; however, an internal
error occurred during the processing of the request. The root cause of
this error depends on which module handles the request and what was
happening in the worker process when this error occurred. IIS was not
able to access the web.config file for the Web site or application.
This can occur if the NTFS permissions are set incorrectly. IIS was
not able to process configuration for the Web site or application. The
authenticated user does not have permission to use this DLL. The
request is mapped to a managed handler but the .NET Extensibility
Feature is not installed.
Things you can try: Ensure that the NTFS permissions for the
web.config file are correct and allow access to the Web server's
machine account. Check the event logs to see if any additional
information was logged. Verify the permissions for the DLL. Install
the .NET Extensibility feature if the request is mapped to a managed
handler. Create a tracing rule to track failed requests for this HTTP
status code. For more information about creating a tracing rule for
failed requests, click here.
The interesting thing is that, when a file is uploaded, it's other dimension versions are created, and I have no problem accessing those. But when I try to access the original file, I'm getting that error. When I try to inspect file permissions on my Plesk control panel, the wp-content and the uploads folder does have the write permission to my user, but when I check the problematic file, Plesk can't access it from the control panel too:
Unable to get the object (C:\Inetpub\vhosts\PATH-TO-MY-IMAGE) security
info: (5) Access is denied. at execute "C:\Program Files
(x86)\Parallels\Plesk\admin\bin\filemng.exe" MY_USER_NAME
--permissions --list-common "--file=C:\Inetpub\vhosts\PATH-TO-MY-IMAGE"
"--accounts=tmpB575.tmp"(RunTime::RunAsUser::run line 260) (Error code
1)
---------------------- Debug Info -------------------------------
I can't even read the permissions on that file. Trying to delete the file using FileZilla results in an error too. This happened to SOME files today, and NOT to others, regardless of upload order, file name or type.
I've checked out many pages regarding this, but they all point to one thing: editing PHP.ini file to change the upload folder. After some search I've created a new PHP.ini like this:
upload_tmp_dir = "C:\Inetpub\vhosts\PATH_TO_A_FOLDER_THAT_I_CAN_WRITE_TO_IN_MY_HTTPDOCS_FOLDER"
Uploaded it to my httpdocs folder, restarted my app pool from Plesk, but no avail. I try uploading new files and I still get the same error. What I haven't understood is that why this started happening today and why is this happening completely randomly (I haven't changed any setting, I haven't entered into any settings pages for weeks). Is this something related to my configuration or should I contact my hosting provider?
It turned out to be a problem with my hosting company at their side. There was nothing I could do.

php and apache http server installation issue

I have installed php-5.4.42-Win32-VC9-x86 and apache_2.4.2-x86-no-ssl.msi in my PC.
According to this
Link
I have installed PHP and apache server and configured. I have restarted my computer after configuration.
I created a phpinfo.php file in the website folder. When i try to run this file in the browser(http://localhost/phpinfo.php) i am getting webpage not available error. But when i run the localhost i am getting as "It Works".
Also when i test the configuration i am getting error as "syntax error on line 172 in httpd.conf, cannot load c:/PHP/php5apache2.2_dll into server.The specified procedure could not be found."
I resolved the problem of this error by changing phpapache2.2_dll to phpapache2.4.dll. I hadve both of them in my php folder.
My PC has 32 bit OS.I have also specified the path of PHP in environment variable.
But still when i run my file i am getting webpage not available.
Can any one help me to resolve this problem.

CodeIgniter HTTP Error 500

When I try to access the website I get this error:
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request
even after removing the htaccess file completely the website is still not working. NOTE: on localhost it's working fine.
Edit after comments:
I think I wasn't clear enough here's my problem in details:
I have a website written with PHP5 no framework or cms or anything and it work fine.
Then I start the admin section so I used CodeIgniter and rewrite the site.
Now I almost done with the programming so I uploaded a test version to the server in a subfolder to test it but the 500 error mentioned above appeared, my first thoughts were that it's a htaccess file problem so I try other htaccess files and finally removed it from the server, but the problem still there.
Now the only difference between my local server and the remote server is that locally i'm running PHP 5.3.5 and remotely it's PHP 5.2.14.
That's all the information that I can think of now.
Thanx in advance.
You likey have a missing PHP/Apache module hence the 500 error.
1: Check your logs within the root and the dir your running script in, else the directory above root/logs.
2: Create a file called phpinfo.php, in it put:
<?php phpinfo(); ?>
and run it.
3: Then compare the list of installed extensions shown in the output with the list of installed modules you have locally.
If your using WAMP, you click the tray icon, goto PHP->extentions and you can see all that are installed. Same for Apache.
boff
additionally:
A good start would to to make sure CURL and MBSTRING is on, however I don't use CAKE PHP....
I got same problem and added this line on top
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

php files downloading instead of opening

I have a Windows 7 laptop. I downloaded PHP 5.2.8. I downloaded Apache 2.2.
I ran the MSI for PHP install, which i know is not recommended but I tried multiple times the normal route without success.
I have apache running and it shows "Running all apache services". When i did the install i set it up for "localhost".
I checked the CGI checkbox in my control panel.
I placed a simple file, test.php , in C:\inetpub\wwwroot ... but when the file is double-clicked, it tries to download the file instead of opening it as a webpage.
I've been googling this for a couple of hours and cant find a suitable fix. I have cleared my cache, and still no luck.
I also set apache to listen on port 8080 just to be certain nothing else was using port 80 before hand.
Any Ideas??
Thanks!
update -- i was missing the php5apache2.dll ... i placed this in the PHP directory but still the same results. i have also tried browsing to the file location through IE which didnt change anything either unfortunately.
update again, - - DOH! - - didnt realize it was localhost/test.php or what the answer below was. when i do that, i get a server error page.. which is better than before i guess :)
Server Error in Application "DEFAULT WEB SITE"
HTTP Error 500.0 - Internal Server Error
An unknown FastCGI error occured
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP
Error Code 0x8007010b
Requested URL http://localhost:80/test.php
Physical Path C:\inetpub\wwwroot\test.php
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
•IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
•IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
•IIS was not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL.
•The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
when i try to start/run apache, it errors out. so when i run apache test configuration i get the following message:
httpd.exe: Syntax error on line 1 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
However when i browse to that director, i do see that dll file there!! ugh...
ideas?
If you placed a file called test.php in C:\inetpub\wwwroot, then you would open your browser to http://localhost/test.php to try to execute the file.
The php5apache2.dll file needs to go in your module directory for apache, and you would need to add the appropriate apache config lines such as those below:
LoadModule php5_module "c:/path/to/php5apache2.dll"
AddHandler application/x-httpd-php .php
SetHandler application/x-httpd-php
After making those changes, you will need to restart apache.
Assuming you have PHP installed in Apache properly as mentioned in the other answers, it is possible the .php page is not sending the correct header. I have a .php file that emits a header with Content-Type: text/json, this is commonly used to provide a service for an Ajax client. The .php page should be sending Context-Type: text/html.
To determine if this is indeed the problem you can use wget with the -S option, or use developer tools in your browser. Take a look at this answer: Tool to view response headers
Double clicked? As in within explorer? If so, this won't open the page. You need to browse to the page. If you're within the directory listing for apache double clicking is not necessary.
As for setting up, if you're new your best bet is to use iis, easyphp, xampp, or some other variation
EasyPHP: http://www.easyphp.org/
Xampp: http://www.apachefriends.org/en/xampp.html
They'll get you running without the hassle

Categories