PHP not working
Posted by: lmcgrath (---.bois.qwest.net)
Date: September 28, 2007 07:12AM

I've just installed WAMP, but I don't see any PHP working!

Here's my test:

<?php
echo "hello world!";
?>

Before I went and messed up my Apache and PHP files, this worked fine. When I tried reinstalling, I couldn't get Apache running again! This was the only reason I switched to WAMP, but it's not working either--all I'm getting is a blank web page.

Any help?

Options: ReplyQuote
Re: PHP not working
Posted by: yfastud (---.cable.mindspring.com)
Date: September 30, 2007 01:33AM

Save all your files in c:/wamp/www/your_new_folder

If you have index file in dir your_new_folder, then access as follows:

[localhost]

If you don't have index file in there or want to access a particular file directly, then access your_file.php or your_file.html as follows:

[localhost]

Or

[localhost]

Have fun,

[www.jlbn.net] (Basic Guide for WAMP and Add-ons)

Options: ReplyQuote
PHP not working
Posted by: ta5na (---.mmu.ac.uk)
Date: October 04, 2007 04:01PM

Hi,

My PHP scripts are not working neither, i have installed WAMP and i suppose everything else works although not tested mysql.

I'm new to PHP and WAMP. My [localhost] works and i have saved all my work onto d:/wamp/www/, as i have checked the php settings and its the same location.

Please help, if someone has a contact number that they dont mind to be contacted by it would be alot more preferable.

Thanks,
Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: yfastud (72.236.169.---)
Date: October 04, 2007 04:29PM

When localhost works, I don't think anything wrong w/ php, so make sure follows this:

If short_open_tag in c:/wamp/apache2/bin/php.ini is not enable, you must use full tag <?php ... ?>

If you enable short tag, make sure to restart your server after edited php.ini

Test your script as my instruction in the post above

Have fun,

[www.jlbn.net] (Basic Guide for WAMP & Add-ons)




Post Edited (10-04-07 16:49)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.mmu.ac.uk)
Date: October 04, 2007 09:24PM

Easy mate,

Yes i have done that and i still have problems with PHP scripts dont work. :-(. Please help

Thanks,
Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: yfastud (72.236.169.---)
Date: October 04, 2007 09:59PM

When access localhost and through wamp welcome page, can you browse to that php page? Did you try it w/ a simple info() php page? If still not working, make sure that all services are running; check by pointing your cursor on wamp tray icon which should say "... all services running..."

Have fun,

[www.jlbn.net] (Basic Guide for WAMP & Add-ons)

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.mmu.ac.uk)
Date: October 05, 2007 12:15PM

Yes mate,

I have done and the echo() scripts will work such as hello.php file:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

Although when i try using scripts like this:

<html>
<body>

Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>

and alot of other scripts dont work, i think the html works but it doesn't read the php scripts. All services are active and i have tried it on another operating system i still get same issues.

I get a blank pages and they dont work, please help.

Thanks,
Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: jw_k (---.net-you.de)
Date: October 05, 2007 01:27PM

Normally you need a .php extension for those scripts.
They must reside in the webspace and must be called like [localhost]
If you get blank pages put the line:

echo '<hr><pre>PHP-GLOBALS-'; print_R($GLOBALS);

near the end of the file between any <?php ?> pair for, e.g., looking at the GET, POST and other vars.

You also may want to look at the error log.

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.lei3.cable.ntl.com)
Date: October 05, 2007 04:17PM

Hey mate,

i got some respond by adding that script to the bottom of the php file, the output that displayed on the screen, is stated below:

PHP-GLOBALS-Array
(
[GLOBALS] => Array
*RECURSION*
[_ENV] => Array
(
[ALLUSERSPROFILE] => C:\Documents and Settings\All Users
[CLASSPATH] => .;C:\Program Files\Java\jre1.5.0_10\lib\ext\QTJava.zip
[CommonProgramFiles] => C:\Program Files\Common Files
[COMPUTERNAME] => TANNA
[ComSpec] => C:\WINDOWS\system32\cmd.exe
[FP_NO_HOST_CHECK] => NO
[INCLUDE] => C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\
[LIB] => C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\
[NUMBER_OF_PROCESSORS] => 1
[OS] => Windows_NT
[Path] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Bitvise Tunnelier;C:\Program Files\Rational\common;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[PROCESSOR_ARCHITECTURE] => x86
[PROCESSOR_IDENTIFIER] => x86 Family 6 Model 13 Stepping 8, GenuineIntel
[PROCESSOR_LEVEL] => 6
[PROCESSOR_REVISION] => 0d08
[ProgramFiles] => C:\Program Files
[QTJAVA] => C:\Program Files\Java\jre1.5.0_10\lib\ext\QTJava.zip
[SystemDrive] => C:
[SystemRoot] => C:\WINDOWS
[TEMP] => C:\WINDOWS\TEMP
[TMP] => C:\WINDOWS\TEMP
[USERPROFILE] => C:\Documents and Settings\NetworkService
[VS71COMNTOOLS] => C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\
[windir] => C:\WINDOWS
[AP_PARENT_PID] => 3268
)

[HTTP_ENV_VARS] => Array
(
[ALLUSERSPROFILE] => C:\Documents and Settings\All Users
[CLASSPATH] => .;C:\Program Files\Java\jre1.5.0_10\lib\ext\QTJava.zip
[CommonProgramFiles] => C:\Program Files\Common Files
[COMPUTERNAME] => TANNA
[ComSpec] => C:\WINDOWS\system32\cmd.exe
[FP_NO_HOST_CHECK] => NO
[INCLUDE] => C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\
[LIB] => C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\
[NUMBER_OF_PROCESSORS] => 1
[OS] => Windows_NT
[Path] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Bitvise Tunnelier;C:\Program Files\Rational\common;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[PROCESSOR_ARCHITECTURE] => x86
[PROCESSOR_IDENTIFIER] => x86 Family 6 Model 13 Stepping 8, GenuineIntel
[PROCESSOR_LEVEL] => 6
[PROCESSOR_REVISION] => 0d08
[ProgramFiles] => C:\Program Files
[QTJAVA] => C:\Program Files\Java\jre1.5.0_10\lib\ext\QTJava.zip
[SystemDrive] => C:
[SystemRoot] => C:\WINDOWS
[TEMP] => C:\WINDOWS\TEMP
[TMP] => C:\WINDOWS\TEMP
[USERPROFILE] => C:\Documents and Settings\NetworkService
[VS71COMNTOOLS] => C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\
[windir] => C:\WINDOWS
[AP_PARENT_PID] => 3268
)

[_POST] => Array
(
)

[HTTP_POST_VARS] => Array
(
)

[_GET] => Array
(
)

[HTTP_GET_VARS] => Array
(
)

[_COOKIE] => Array
(
)

[HTTP_COOKIE_VARS] => Array
(
)

[_SERVER] => Array
(
[HTTP_USER_AGENT] => Opera/9.20 (Windows NT 5.1; U; en)
[HTTP_HOST] => localhost
[HTTP_ACCEPT] => application/xhtml+voice+xml;version=1.2, application/x-xhtml+voice+xml;version=1.2, text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
[HTTP_ACCEPT_LANGUAGE] => en-GB,en;q=0.9
[HTTP_ACCEPT_CHARSET] => iso-8859-1, utf-8, utf-16, *;q=0.1
[HTTP_ACCEPT_ENCODING] => deflate, gzip, x-gzip, identity, *;q=0
[HTTP_REFERER] => [localhost]
[HTTP_CONNECTION] => Keep-Alive, TE
[HTTP_TE] => deflate, gzip, chunked, identity, trailers
[PATH] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Bitvise Tunnelier;C:\Program Files\Rational\common;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL
[SystemRoot] => C:\WINDOWS
[COMSPEC] => C:\WINDOWS\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[WINDIR] => C:\WINDOWS
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.2.4 (Win32) PHP/5.2.4
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => C:/wamp/www
[SERVER_ADMIN] => webmaster@localhost
[SCRIPT_FILENAME] => C:/wamp/www/How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[REMOTE_PORT] => 1642
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /How%20to%20do%20everything%20with%20PHP%20&%20MySQL%20exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[SCRIPT_NAME] => /How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[PHP_SELF] => /How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[REQUEST_TIME] => 1191593151
[argv] => Array
(
)

[argc] => 0
)

[HTTP_SERVER_VARS] => Array
(
[HTTP_USER_AGENT] => Opera/9.20 (Windows NT 5.1; U; en)
[HTTP_HOST] => localhost
[HTTP_ACCEPT] => application/xhtml+voice+xml;version=1.2, application/x-xhtml+voice+xml;version=1.2, text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
[HTTP_ACCEPT_LANGUAGE] => en-GB,en;q=0.9
[HTTP_ACCEPT_CHARSET] => iso-8859-1, utf-8, utf-16, *;q=0.1
[HTTP_ACCEPT_ENCODING] => deflate, gzip, x-gzip, identity, *;q=0
[HTTP_REFERER] => [localhost]
[HTTP_CONNECTION] => Keep-Alive, TE
[HTTP_TE] => deflate, gzip, chunked, identity, trailers
[PATH] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Bitvise Tunnelier;C:\Program Files\Rational\common;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL
[SystemRoot] => C:\WINDOWS
[COMSPEC] => C:\WINDOWS\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[WINDIR] => C:\WINDOWS
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.2.4 (Win32) PHP/5.2.4
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => C:/wamp/www
[SERVER_ADMIN] => webmaster@localhost
[SCRIPT_FILENAME] => C:/wamp/www/How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[REMOTE_PORT] => 1642
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /How%20to%20do%20everything%20with%20PHP%20&%20MySQL%20exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[SCRIPT_NAME] => /How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[PHP_SELF] => /How to do everything with PHP & MySQL exercises/pg70_Arithmetic_Operators_simultaneously_diff_way.php
[REQUEST_TIME] => 1191593151
[argv] => Array
(
)

[argc] => 0
)

[_FILES] => Array
(
)

[HTTP_POST_FILES] => Array
(
)

[_REQUEST] => Array
(
)

[a] => 10
)

------------------------------------------------------------------------------------------------------------------

In the PHP file the script data was:

<?php
$a += 10;

echo '<hr><pre>PHP-GLOBALS-'; print_R($GLOBALS);
?>

and i saved the file as "pg70_Arithmetic_Operators_simultaneously.php"

------------------------------------------------------------------------------------------------------------------

I tried running this script file below, which i got out the book and it was a blank page again: There is something wrong i wish this is resolved asap.

<?php
// define variables
$num1 = 101;
$num2 = 5;

// add
$sum = $num1 + $num2;

//substract
$diff = $num1 - $num2;

//multiply
$product = $num1 * $num2;

// divide
$quotient = $num1 / $num2;

// modulus
$remainder = $num1 % $num2;
?>


I hope we can resolve this issue!

Thanks alot for your help,
Very appreciated,

Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: jw_k (---.net-you.de)
Date: October 05, 2007 05:31PM

you don't tell php to let apache echo the results to the browser!

try something like this (and get you a book "php for beginners" or somesuch winking smiley :

<?php
// define variables
$num1 = 101;

--8<--

// modulus
$remainder = $num1 % $num2;
echo 'remainder:', $remainder;
?>

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.lei3.cable.ntl.com)
Date: October 05, 2007 06:29PM

Hi mate,

Yes finally, i tried the code:

-----------------------------------------------------------------------------------------------

<?php
//define variables
$num1 = 120;
$num2 =106;

// modulas
$remainder = $num1 % $num2;
echo 'remainder:', $remainder;
?>

-----------------------------------------------------------------------------------------------

and the browser responded:

remainder:14

-----------------------------------------------------------------------------------------------

So the other codes that i was trying to use from the book "How to do everything with PHP & MySQL" such as:

-----------------------------------------------------------------------------------------------

<html>
<head><basefont face="Arial"></head>
<body>

<h2>James Bond</h2>

<?php
$identity = 'James Bond';
$car = 'BMW';

// this would contain the string "James Bond drives a BMW"
$sentence = "$identity drives a $car";

// this would contain the string "$identity drives a $car"
$sentence = '$identity drives a $car';
?>

</body>
</html>

-----------------------------------------------------------------------------------------------

Is wrong? How come none of the exercises work from there and some of the php code from the internet.

Do you have msn messenger address that i can add you to for some help, please.

Thanks alot,
Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: jw_k (---.net-you.de)
Date: October 05, 2007 07:29PM

>Is wrong?
apparently.
google will help you to find a better tutorial winking smiley

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.lei3.cable.ntl.com)
Date: October 05, 2007 07:47PM

Hi matey,

So you think everything with my php and apache is working correctly?

Anyways to test mysql with php with a few scripts. You have any good websites for tutorial that you could also suggest.

Very appreciated, with all your help.

Thanks,
Mitesh Tanna



Post Edited (10-05-07 19:48)

Options: ReplyQuote
Re: PHP not working
Posted by: yfastud (---.mia.bellsouth.net)
Date: October 05, 2007 10:39PM

Quote

So you think everything with my php and apache is working correctly?
Yep, definitely!!!

Quote

Anyways to test mysql with php with a few scripts. You have any good websites for tutorial that you could also suggest.
I think your current book is ok, but some things to keep in mind that your book might be not up to date, I mean, it's might be for previous version of php and mysql, therefore, not all the codes would work, so you might want to play around w/ it a little bit, or google for some current changes

Also, sometimes the change of single quote and double quote might have the effect as well.

Since you're new to this wamp, you might want check my side for some other setups



Have fun,

Web site for Testing codes
Web site for Basic Guide for WAMP & Add-ons




Post Edited (10-05-07 22:42)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: PHP not working
Posted by: ta5na (---.lei3.cable.ntl.com)
Date: October 06, 2007 12:33PM

Thanks alot for all your help, by any chance do you have msn messenger or something that i can keep in contact if possible, please.

Thanks,
Mitesh Tanna

Options: ReplyQuote
Re: PHP not working
Posted by: jsprajapati (59.95.231.---)
Date: October 19, 2007 06:51AM

Php script running after making a tag with php ie...

Not working
<?
echo "Hello";
?>


Working
<?php
echo "Hello";
?>

Options: ReplyQuote
Re: PHP not working
Posted by: iblastoff (---.cpe.net.cable.rogers.com)
Date: October 19, 2007 07:43PM

um you have to enable short tags.

Options: ReplyQuote


Sorry, only registered users may post in this forum.