I was having permission issues with IIS 8.0 on my Windows Server 2012 box, so I decided to remove & re-add the role in an attempt to fix it.
This seems to have fixed my permission problems, but now my PHP wont work!
I get this error when trying to access a .php file
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration.
If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Obviously what I need to do here is add a handler to one of the files in my php install folder (which I installed using the web app manager thing) but I don't know where I add a handler from? I know where to add MIME maps from but obviously that isn't going to solve this.
UPDATE: So I followed one of the answers which linked me to the PHP site, followed what it said and that seems to have fixed the PHP no running problem, but now thats opened a whole new can of worms. I'm getting the same Access is denied. error as before! even when i change file extensions to .html, it appears my site isnt directing to the default document, as when i go to www.mysite.co.uk, i get the error, but if i go to www.mysite.co.uk/index.php, it works fine! i have a index.php entry in my default documents, and a index.html, and neither seem to be working after the PHP install
permission on the root directory are full control to, Administrator, My user account, 'NETWORK SERVICE' and 'SYSTEM', just to note, i couldnt get the site to work at all without setting the 'connect as' option to my user account and password, so thats what its using to access the files.
I think this may help you;
http://php.net/manual/en/install.windows.iis7.php
It says for iis7 and above, let me know if doesn't work and I'll dig deeper.
The process is;
1 - Configure CGI- and FastCGI settings in your php.ini such as
Fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
2 - Then in Windows type inetmgr into run under the start menu.
3 - Select the server node in the window that opens which is in the connections tree.
4 - In the central pane, known as the features view, openthe Handler Mappings feature.
5 - In the actions pane click **Add Module Mapping..."
6 - Use these details to fill in the blanks;
Request path: *.php
Module: FastCgiModule
Executable: C:\[path to php install]\php-cgi.exe
Name: PHP_via_FastCGI
7 - Click request restrictions and then configure the mapping to invoke handler only if request is mapped to a file or folder.
8 - Click okay on all dialogues to save the config.
The link at the top provides further information on configuration examples and how to do this from the command line. You should restart IIS once you're done.
Related
So I am trying to get Symfony working on my server by following these install instructions.
http://symfony.com/doc/current/book/installation.html#book-installation-permissions
I got to the part where I ran this command in console in the directory where I wanted the framework to be installed.
symfony new my_project_name
I then followed these instructions to set my web root directory to /web as I believe I'm supposed to do?
It installed all the files correctly since I can see them in the folder. I made sure to restart apache and I'm positive document root is in the correct location.
http://tecadmin.net/how-to-change-document-root-of-primary-domain-in-cpanel/#
Once I did this I was supposed to be able to test the installation, but nothing seems to happen except that 406 error?
This is the exact error I get.
An appropriate representation of the requested resource /app.php could not be found on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
I'm not sure what else to do.
Please note, that since I'm using CPANEL I can't change the virtual host configurations of apache if that is the issue, so I'm looking for a CPanel specific answer. Thank you!
Okay so I finally figured out what to do, I had 2 problems. Because I installed as the 'root' user I had to run the following command on the symfony installation.
chown -R devdistribution:devdistribution .
In my case, my username is devdistribution but you would just put your own. Make sure to do this on the top level not just the /web folder.
I knew this was one of the errors because the apache log said something along these lines
Mismatch between target UID (520) and UID (501) of file "/home/devdistribution/public_html/distribution_tech/web/app.php"
This fixed the 500 error, but not the 406. To fix the 406 error you need to login into WHM and type modsecurity to find it in the search field.
go to the configuration option for it, you will see this.
Rules Engine SecRuleEngine
This setting controls the behavior of the rules engine.
Process the rules.
Do not process the rules.
Process the rules in verbose mode, but do not execute disruptive actions.
Select 'Do not process the rules'. Then save at the bottom. This fixed the issue for me and I was able to see the opening symfony screen!
However, this I'm sure leaves security vulnerabilities now...so I still need help on the proper way to handle mod security with symfony in this case if anyone knows? I'll make a separate question for this.
Step 1:
Login to your cPanel account and start searching for the file manager icon under the files section.
Step 2:
As always, you need to make sure, you see the public_html directory. Depending on the web hosting you have, you may also see the home directory after opening the file manager.
Step 3:
Find the .htaccess file and right-click to edit.
Step 4:
After choosing an edit option, you see a popup asking to disable encoding if you wish. You have to click on the Edit button to continue.
Step 5:
On a new tab, you can see many rewritten rules. You have to add the code to the .htaccess file.
<IfModule mod_security.c>
SecFilterEngineOff
SecFilterScanPOSTOff
</IfModule>
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.
I updated my joomla site to 2.5 from joomla 1.7 I faced below errors:
1- I cannot open global configuration page from the admin area and receive "500 internal server error"
2- When I press the add new article button from the admin area I receive the same error.
3- When I press the add new category button from the admin area I receive the same error.
appreciate if you can help to solve this.
I had the same issue and was about to go crazy (even considered switching to another CMS) ... the problem appears to be related to the fact that Joomla 2.5 is throwing several errors and the PHP engine was trying to write to the php_errors.log file in a directory where it didn't have write permissions, thus the 500 error (misleading I know).
Incidentally, this happened to me on a Windows box running IIS 7.5, not Apache. The solution, intiailly was to edit my PHP.INI file and change the "error_log" setting to point to a folder which had write permissions for all websites. I just created a new folder and gave the 'users' group modify permissions - not the best way to do it but for development purposes, it was ok.
You then have to restart IIS.
It is important that you actually restart IIS, not just restart the application pool, as this didnt seem to force PHP to re-read the config.
Once I got this far, I started noticing errors (which I will continue to post here among other places until I can find a solution). So far, the first error I see is when I go to add a New Menu Item, i get this:
Warning: is_file(): open_basedir restriction in effect. File(\metadata.xml) is not within the allowed path(s): (C:\Inetpub\vhosts\myWebsite.com\httpdocs\) in C:\Inetpub\vhosts\myWebsite.com\httpdocs\libraries\joomla\filesystem\file.php on line 523
It appears that Joomla is trying to verify if the \metadata.xml file exists, however I'm not sure where that file is or what it does. At this point, i suspect it's still ultimately a permissions problem, but I'm still digging...
The most common cause of 500 error that I've seen on Joomla! websites is related to the permissions of the files on the website. eg. yesterday we had to fix a website for a company that had upgraded and in the process somehow set the Group write permission on their /administrator directory.
You can check this quickly through the file manager of your hosting service, if using CPanel you should make sure your directories are set to 755 (User has read/write/execute permissions, Group and World have read permission) and files set to 644 (User has read & write permissions, Group and World have read permission).
These sound like the same issue.
See this rundown of potential upgrade problems by Brian Teeman:
http://brian.teeman.net/joomla-1.7/upgrading-to-joomla-2.5-some-warnings.html
The problem you are having could be related to the database issue he mentions.
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
I'm running IIS 7 on Windows 7.
I've installed PHP v5.3 through WebMatrix, set up a website for my PHP app in IIS, and enabled read/write access for 'Everyone', for the directory.
When I browse to the application, I get the following error:
HTTP Error 500.0 - Internal Server Error
<handler> scriptProcessor could not be found in <fastCGI> application configuration
Error Code 0x80070585
Here's what I tried:
Ensured that CGI is installed (Windows Features --> Internet Information Services --> World Wide Web Services --> Application Development Features --> CGI; it was already ticked.)
Commented out all of extensions under the '[ExtensionList]' section in 'php.ini'.
Noticed some discussion online about editing a file called 'fcgiext.ini'. Did a file-search on my hard drive for this file; 0 results.
Noticed this discussion, advising that whatever is in the scriptProcessor attribute of the handlers section should also be in the fastCgi section. But I already have a file called 'Web.roleconfig' in my PHP application path, which already has a fastCgi section:
<fastCgi>
<application fullPath="%RoleRoot%\approot\Php\php-cgi.exe" arguments="-c %RoleRoot%\approot\Php\php.ini" />
</fastCgi>
Sorry if this is all a bit incoherent. I'm not a PHP expert, and I'm not sure where to begin to solve this problem.
At the least, any hints as to whether this is an IIS or PHP or FastCgi issue would be a great help.
I'd try using PHP Manager to see if PHP is configured correctly for IIS.
Install PHP Manager from here, http://phpmanager.codeplex.com/
Then run it within IIS (appears as a module in IIS Mgr) to see if PHP is registered. If it isn't, click Register New version, navigate to php-cgi.exe and select it. Then click on Check PHPInfo() to ensure it's running.
Hope that helps.
Mark
All solutions proposed above are based on tools. The underlying IIS mechanism for FastCGI support was not mentioned in details, but is the key to get things right.
PHP binaries for Windows must be extracted somewhere and you need to get its php.ini ready.
Add a module mapping in Handler Mapping section of IIS Manager (or equivalently in applicationHost.config file) at server or site level.
Make sure at server level's FastCGI Settings section of IIS Manager the php-cgi.exe is registered (though at previous step IIS Manager should ask if you want it to help add this entry automatically).
This IIS.net article lists more info, but it failed to mention the last step,
https://www.iis.net/learn/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php#13
while this PHP page reveals almost everything with screenshots,
https://secure.php.net/manual/en/install.windows.iis7.php
If you get 500.0 and 0x80070585, it is very likely that the last two steps are not completed, and you need to go back to IIS configuration.
You need to include the (Fast)CGI applications's arguments in the handler definition.
Unfortunately, this is not described in the add handler documentation, but just appears in sample documentation (1, 2) about setting up PHP with IIS:
To create these mappings, the settings in the fullPath and arguments attributes for an element must be added to the scriptProcessor attribute in the mapping for the FastCGI process and separated by the pipe "|" character.
So in your particular case the scriptProcessor within the handler definition would need to be set to:
<handlers>
...
<add ... scriptProcessor="%RoleRoot%\approot\Php\php-cgi.exe|-c %RoleRoot%\approot\Php\php.ini" />
...
(Haven't checked if the env vars don't cause a mapping issue, though.)