my first PHP code is not working

General discussion on Zend Studio
Post Reply
warr4207
Posts: 4
Joined: Wed Mar 05, 2014 6:22 pm

my first PHP code is not working

Post by warr4207 » Wed Mar 05, 2014 6:31 pm

i am a newbie and trying to learn php. i installed the zend eclipse for php developer and started my first simple code test.php as

Code: Select all

<?php
  echo "hello world"
?> 
when i run the code it brings up the url http://localhost/simple_blog/test.php and got this error:

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.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9

please advise.

thank you,
warren
Attachments
test_php.doc
screen shots
(235.5 KiB) Downloaded 232 times

User avatar
natalia_b_zend
Posts: 366
Joined: Wed Jan 25, 2012 5:51 pm

Re: my first PHP code is not working

Post by natalia_b_zend » Thu Mar 06, 2014 11:29 am

What is your project structure and what's the location of your project? Did you create it inside htdocs directory?
Natalia Bartol
Zend Studio Team

warr4207
Posts: 4
Joined: Wed Mar 05, 2014 6:22 pm

Re: my first PHP code is not working

Post by warr4207 » Thu Mar 06, 2014 10:47 pm

on the left panel on the PHP Explorer

simple_blog
index.php
test.php

the code is in the folder r:\warren\PHP

User avatar
natalia_b_zend
Posts: 366
Joined: Wed Jan 25, 2012 5:51 pm

Re: my first PHP code is not working

Post by natalia_b_zend » Mon Mar 10, 2014 2:23 pm

OK, your code is not inside htdocs (is not deployed to a PHP server), so you cannot run it as PHP Web application. You can try to:
#1 right click your test.php
#2 Run as > PHP CLI script
Natalia Bartol
Zend Studio Team

warr4207
Posts: 4
Joined: Wed Mar 05, 2014 6:22 pm

Re: my first PHP code is not working

Post by warr4207 » Tue Mar 11, 2014 4:55 pm

thank you natalia. i run as PHP CLI application and i got this error:

The currend debuger does not have any defined PHP executables.
Please defined a PHP executable location before continuing.

warr4207
Posts: 4
Joined: Wed Mar 05, 2014 6:22 pm

Re: my first PHP code is not working

Post by warr4207 » Tue Mar 11, 2014 6:57 pm

i also tried to redo from the start and build the code on C:\Program Files (x86)\xampp\htdocs folder. using the same simple code and when i got the same issue.
Attachments
FirstPHPcodeNotWorking.doc
screen shot of the issue
(134 KiB) Downloaded 310 times

User avatar
natalia_b_zend
Posts: 366
Joined: Wed Jan 25, 2012 5:51 pm

Re: my first PHP code is not working

Post by natalia_b_zend » Tue Mar 25, 2014 7:11 pm

You need to define a PHP executable. Go to Window > Preferences > PHP > PHP Executables and 'Add' the locaiton of your php binary!
Natalia Bartol
Zend Studio Team

Post Reply