Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm wondering why I cannot display the simple "hello world" using php language.
This is how my code looks like:
<?
echo "Hello world";
?>
and this is how the output come out in the browser, nothing display:
You need to make sure following things for executing php file.
Php tag should be properly open and close <?php ... ?>
You xampp server is properly running.
You are accessing file by putting correct path.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am trying to run
$var = "Guru & Hari - Priya";
if(preg_match('/^[A-Za-z0-9& -]+$/', $var)){
echo "Hi";
}else{
echo "bye";
}
Somehow code is unable to understand "&".
Per regex101.com above code is fine.
Please share why PHP is unable to recogonise &
not-an-answer
You should mention/consider your string source.
What you see as & is probably & in your text value.
The browser rendition is not always an exact representation of your data.
See also: PHP Regex: Matching Ands - & and &
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I got some code like this and the header is not working
if ($variable > 0) {
header('Location: mypage.php');
exit;
}
And I need exit function, is this a bad idea?
If your code produces any output text before header directive then header directive will be ignored.
Even if header is located before any output (HTML or PHP), be sure not to have any characters nor spaces between beginning of PHP file and <?php tag.
However, there is a chance that header directive will be accepted even if there is output present before it, if written text is still in the PHP output buffer and nothing has yet been sent to web server. But, to be safe, make header the first thing before any text output.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
im copying a file from another domain. It does not give me any errors but the files does not get recognized and its different size from the original file. Its the same extension i checked. so im kinda clueless.
if (!copy('http://maholi.com/image/data/Products/Linen - Juvenile and Infant/1440.jpg', $_SERVER['DOCUMENT_ROOT'].'/resources/categories/tttt6.jpg')) {
echo "failed";
}
any ideas?
This works fine for me:
if (!copy('http://maholi.com/image/data/Products/Linen%20-%20Juvenile%20and%20Infant/1440.jpg', $_SERVER['DOCUMENT_ROOT'].'/tttt6.jpg')) {
echo "failed";
}
Edit: URL's are not allowed to contain spaces. See "Is a URL allowed to contain a space?". Your web browser will automatically encode illegal characters, making you believe they are allowed.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Putty executes my php script without error but no results. This script is supposed to run a query on the database and the send those results as excel file. Does anyone know what could cause this?
Try prepending your script with:
<?php
error_reporting(E_ALL);
?>
to output all errors. Failing that, you could put some debug in the code to find where it keeps failing.
Sometimes there is something in the PHP error log (/var/log/php_errors on Centos).
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I started learning PHP today and I've been trying to make a "Hello World" program, but when I type the code into the editor it does not appear in the browser, it's commented. What might be the issue ? I have XAMPP installed, and enabled Apache.
Code: http://i.imgur.com/khOPvSD.png
Browser: http://i.imgur.com/uQd25Qb.png
You are having
<?echo
Change to <?php
Every code that is PHP must be within the <?php ?> tags.