I'm sorry in advance for being a noob
So I started taking a php course the instructor told viewers to install mamp or xammp
A quick google search said Wamp is better for windows so I went along with it, the problem I faced was that the php files I created were not being executed whereas the professor's php web application worked perfectly, I did everything correctly. I created a text doc replaced txt with php extension and then wrote a simple code
<?php> echo "hello world" ?>
This was not being executed, the server kept saying unable to handle this request.
So I uninstalled wamp and installed mamp, I deleted the original files from httdocs which were a simple index.php and jpg file.. I pasted two folders, one my professor's web application and the second being my practice lab. And again it displayed the same regardless of the fact that I'm opening the file through the index directory
I don't know what's the error. Can anyone help me?
I am trying to get this run for almost 3 hours
As per the comments above...
Seems like it could be a 500 internal server error. Try <?php echo "Hello world"; ?>
500 internal server errors are shown when your php code has fatal errors that can't be processed.
Your error come from opening and closing tag.
Based on PSR-1
It should be <?php and ?> but not <?php>
PHP code MUST use the long <?php ?> tags or the short-echo <?= ?>
tags; it MUST NOT use the other tag variations.
Related
As I am using the local hosting of MAMPbut " There has been a critical error on this website" this is error is coming. What should I do?
Diagnostic steps worth giving a shot, follow from top to bottom order;
Is MAMP really running with Web server (and additionally the database server)?
Do you see the default MAMP index/home screen?
Put a simple HELLO WORLD HTML document to your project root and check if you can see it on browser
Put a simple HELLO WORLD PHP script to your project root and check if you can see it on browser
At this point, if everything above went well, it is definitely an issue with your actual PHP script, check the PHP error log file
Put an INFO.PHP PHP script at your project root and check you have all the required extensions available for your PHP project
Check if database connection is working (if required)
At this point, I cannot imagine what else would go wrong, try PHP debugger (xDebug needs to be installed with MAMP and your PHP editor may need a configuration for this) with break points and step into each line of your PHP code with debugger.
I have a website with multiple pages that I uploaded onto the Ligtsail Bitnami LAMP server using FileZilla.
The .HTML pages work fine. The .HTML pages that use jQuery to GET or POST php work fine.
The .php pages that contain HTML or are simply PHP do NOT work at ALL. When I go into inspector to see what is wrong, none of the HTML or JS that is contained in the .php files is shown, instead this is all that is displayed in the inspector:
<html>
<head></head> == $0
<body></body> == $0
<html>
And the following error is displayed:
"filename.php:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)"
When tested on localhost using XAMPP, all files work. I am new to servers and I hope this is just a newbie issue, let me know if there is any other information I can include.
I checked the /opt/bitnami/apache2/logs/error_log and these are my errors:
PageSpeed Serf fetch failure rate extremely high; only 1 of 21
recent fetches fully successful; is fetching working?
localhost: server certificate does NOT include an ID which matches the server name
Bitnami Engineer here,
The Bitnami LAMP solution in the Lightsail platform comes with Apache and PHP preconfigured for you to use. From your message, you are getting a 500 error message. I understand there is something wrong in the PHP code you are trying to load and that's why that 500 error occurs. Can you try to create a simple "Hello World" page with PHP in the /opt/bitnami/apache2/htdocs folder and see if everything works as expected
<?php
echo '<p>Hello World</p>';
?>
If you get the Hello World message when accessing yoursite/file.php, that means that PHP is working properly. If you keep getting errors, you can take a look at the Apache's log file (/opt/bitnami/apache2/logs/error_log) to get more information about them
https://docs.bitnami.com/aws/infrastructure/lamp/troubleshooting/debug-errors-apache/
I need help to preview my php file. I've been trying for days now and can't get it to work. My apache and mySQL servers are both connecting.
I've set up my Brackets and it did open up a preview screen in Chrome but whatever i have in the file just won't show up.
Please help me out, thanks!
Angel
From here, it appears that you're probably getting a silent PHP parse error, you can check the PHP log in MAMP to confirm.
The standard PHO opening tag is
Give this a try:
<?php
echo "Hello world";
?>
I am attempting to install PHP onto Windows Server 2008 R2. I have followed the instructions here but when I try to load phpinfo.php I get a blank page.
There are no errors in the Event Viewer.
The server is used to host multiple other Asp.Net websites but I am using PHP so that I can install MediaWiki.
UPDATE:
When trying to load simple HTML (with no PHP) it also loads as blank. The fix for this seems to be to enable "Static Content" in the "Turn Windows features On/Off" manager - but this is already in place.
This happened to me as well just running the handy dandy php installer microsoft has on their site using their Web Platform Installer and it turned out in the php.ini file by default short_open_tag by default is off so my code
<?
print("hello world!");
?>
would not work because it was expecting
<?php
print("hello world!");
?>
.... so yea ... just go and change that if this is your problem too!
If copying over an old Wordpress installation from an old server - make sure you copy ALL the files. Oops... <embarassed>
A blank page is also possible when there is an PHP error and error reporting is of. Try to run the script below to see what happens.
<html>
<body>
Hello HTML
<?php
error_reporting(E_ALL);
echo "Hello PHP";
?>
</body>
</html>
You could also try to see if a normal HTML page with PHP extentions runs fine. Perhaps your server is setup to disallow PHP extention.
You have to configure fastCGI for each PHP website, more details you can find here - Best Practices for Configuring FastCGI and PHP
So I found the solution after hours of randomly trying things. I removed and re-added the Static Content role in Windows - still same result. Then I edited the Error Pages feature of the website in IIS to say return Detailed Error Messages. At this point PHP started to complain about the timezone so I set to "Europe\London" - for this to take effect you need to restart IIS.
After that it worked, phpinfo now loads!
I had this issue; at "turn Windows features on or off", I enabled:
HTTP Errors
Server-Side Includes
Directory Browsing
Windows Authentication
I also set these options in C:\Program Files (x86)\PHP\v5.3\php.ini:
display_errors = On
display_startup_errors = On
After that, a 401 Unauthorized error was displayed. I added 'Everyone' and 'Users' groups to the folder to fix.
I have uploaded my PHP project created using Eclipse-PDT to the siteground server.
After completing the upload, i tried to run the php pages and it throws an error saying "Expected End of statement".
Then i logged in to the CPANEL and found that all the line breaks are removed from the script. since i have used "single line comments" in my php script ,its throwing error(next line will also append to the previous line)
can anybody help to solve this issue? i have a lot of php pages ,so its not possible to remove all single line comments from all the pages.
Maybe its caused by different file encoding?
Check which format is used in your editor.