Jump to content
Larry Ullman's Book Forums

Example Code Running Problems


Recommended Posts

Hi

As a newcomer to php i am trying to run the example scripts but i am not doing well up to now! Maybe a trivial question but is there a bit detailed guide cause even copypasting the code in a html and a php file in the same directory (htdocs/something) does not seem to work! I have installed xampp and apache which seem to be running ok, but i have some problems like the $_POST not taking any values from the html file, etc. i tried netbeans but for me it is a little bit complicated. Thanks in advance for any help!

Link to comment
Share on other sites

I created (netbeans) a new php project (i can not find how to create a simple php file/script), renamed it from index (by saving as ...) and placed it in the suggested by netbeans folder "PhpProject1", at C:\xampp\htdocs\PhpProject1. Maybe silly, but thats my level of programming skills :). When i type the above url (in Chrome) i get
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404 localhost
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
 
NOTE When i type localhost now,  i get a directory listing!
 
 
 
 
This is the project code
 
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo "put your code here";
        ?>
    </body>
</html>
Link to comment
Share on other sites

 

System

 

Windows NT IDEAPAD 6.2 build 9200 (Unknown Windows version Home Premium Edition) i586

 

Build Date

 

Aug 21 2013 01:07:08

 

Compiler

 

MSVC9 (Visual C++ 2008)

 

Architecture

 

x86

 

Configure Command

 

cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"

 

Server API

 

Apache 2.0 Handler

 

Virtual Directory Support

 

enabled

 

Configuration File (php.ini) Path

 

C:\WINDOWS

 

Loaded Configuration File

 

C:\xampp\php\php.ini

 

Scan this dir for additional .ini files

 

(none)

 

Additional .ini files parsed

 

(none)

 

PHP API

 

20100412

 

PHP Extension

 

20100525

 

Zend Extension

 

220100525

 

Zend Extension Build

 

API220100525,TS,VC9

 

PHP Extension Build

 

API20100525,TS,VC9

 

Debug Build

 

no

 

Thread Safety

 

enabled

 

Zend Signal Handling

 

disabled

 

Zend Memory Manager

 

enabled

 

Zend Multibyte Support

 

provided by mbstring

 

IPv6 Support

 

enabled

 

DTrace Support

 

disabled

 

Registered PHP Streams

 

php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar

 

Registered Stream Socket Transports

 

tcp, udp, ssl, sslv3, sslv2, tls

 

Registered Stream Filters

 

convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*

 

Link to comment
Share on other sites

I try the examples creating one html form and one php script and when i load the html form through a url the script is executed (sometimes!) but the POST or GET superglobals return no value (from the form input) they are just returned as strings! So i think there is no communication between the html and the php scipt! Or i am doing something wrong! (Neewbie you see!)

Link to comment
Share on other sites

OK, I put the two files at the htdocs directory (not in a separate folder) and everything worked out! I really thank you for your time, guys! My next question would be now how can i save the examples of the book each on its own directory (under htdocs) and test them? Do i have to tweak the actual code or the web server or what? 

 

 

PS

i typed http://localhost/posting.html  entered some text etc, and when  i got the reply the URL was http://localhost/handle_post.php!

 

PS2

I live in Greece so the time difference is quite much and i do not answer fast!

Link to comment
Share on other sites

Please disregard my last posting! I can run the scripts even from other directories i make! The main point was that i did not load the form through a URL, as Larry suspected (that's why he is the writer of books and we the readers :)  

Link to comment
Share on other sites

 Share

×
×
  • Create New...