Jump to content

Echo not outputting anything!


Go to solution Solved by mac_gyver,

Recommended Posts

Php 101 -

  1. php is a server-side scripting language. do you have a web server with php installed?
  2. the php file must be placed in the web server's document root folder, which may have different paths/names depending on what operating system  is in use and how you obtained and installed the web server/php.
  3. to run a php script, you must make a http(s) request to the web server. what URL did you use in your browser to request the file? it should be something like - http://localhost/1.php (for a localhost development system.) if is starts with file:///..., that's not a URL, that's a filesystem path, which means that you opened the .php file directly in the browser, which won't invoke the php language engine that's installed on the web server.
  4. if you made a http(s) request to a URL and got a blank page, what does the 'view source' of the page in your browser show? you can also check in your browser's developer tools, network tab to see what the response is.

what output do you get, e.g. item #4 on my list?

do you have php's error_reporting set to E_ALL and display_errors set to ON, in the php.ini on your system, so that php will help you by reporting and displaying ALL the errors it detects? stop and start your web server to get any changes made to the php.ini to take effect and check using a phpinfo(); statement in a .php script that the settings actually got changed to those values.

  • Solution

there's nothing wrong with the POSTED code (just tested.) errors like this are usually caused by copy/pasting code that's been published on the web, with smart/curly quotes, which then produce php errors since those type of characters have no meaning in php, but which get converted back to straight quotes when code gets posted on a programming help forum, and therefor work when tried.

delete and re-type the line of code.

  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.