Web Design Forums

Welcome! Please register or log in: Forgot your password? Why register?
You are here: Web Design Forums » Programming Help » PHP » Wierd PHP -- Compilation Bug?? RSS

Wierd PHP -- Compilation Bug??

This thread was started by Danny[MLWA] and has been viewed 880 times, and contains 15 replies, with the last reply made by aburningflame.
Post Reply
1
32 points at 100%
Posted June 21 '09 at 03:53 PM
      Posts: 76
I ran into this problem yestarday and just wondering if this is the new version of PHP or if it is something as simple as a buggy compile...

Line 1$var1="testval"//This is the first test val
Line 2$var2="testval"//This is the second test val
Line 3$var3="testval"//This is the third test val 

Would not run past line 2. After banging my head over this for hours, Ir emoved the comments, and it worked perfectly... It is like you can't do in-line comments like that any longer after the line break " ; " =(.

index.php:
<?php
require_once('functions.php');
echo 
test_function("This is a test");
?>

functions.php:
<?php
function test_function($test)
{
return 
$test
}
?>

This first of all displays an error on the page... "The constant PHP could not be defined, assuming "PHP". Oh yeah gets better...

Undefined function "test_function".
Lead Web Designer
MLW & Associates, LLP.
W3C Standards Complaint and SEO Friendly
Admin of Vraul

Advertisement Register for free to hide these ads and participate in discussions!

2
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 21 '09 at 05:22 PM
      Posts: 777
i have tried several times to create and use functions with very little to no predictable results. i get an error every time. and yes i have followed the manual and a lot of other tutorials out there but function and class is about useless. the examples i see that could work, take more code then it would take just coding to order.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

3
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 21 '09 at 06:07 PM
      Posts: 11,793
Lowercase <?php, not <?PHP.
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

4
32 points at 100%
Posted June 21 '09 at 07:16 PM
      Posts: 76
Lowercase <?php, not <?PHP.

Yeah man, it was lowercase -- I'm sure of that. It was even bugging out on the functions and comments... basically if the line had a comment in it (//) it wouldn't even parse the entire line... so $var = "var"; // $var would remain undefined.
Lead Web Designer
MLW & Associates, LLP.
W3C Standards Complaint and SEO Friendly
Admin of Vraul

5
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 22 '09 at 12:00 PM
      Posts: 11,793
There's no way a comment could affect the code like that. You may want to attach the files rather than copy/paste.
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

6
32 points at 100%
Posted June 22 '09 at 12:09 PM
      Posts: 76
Its the wierdest thing I've ever seen... Recompiled... did the same thing... recompiled again, did the same thing... Deleted all of the files from my office pc, redownloaded all of the files from the server again, opened them in the editor, and it looked like this:

<?php include('config.php'); // Get the config file define("DB_HOST", 'localhost'); // Leave it at localhost ...................  

Everything was on one line like the FTP transfer or something was removing all of the returns...

Switching the FTP transfer from "auto" to ascii, it worked fine.
Lead Web Designer
MLW & Associates, LLP.
W3C Standards Complaint and SEO Friendly
Admin of Vraul

7
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 22 '09 at 02:07 PM
      Posts: 777
lol why are you using ftp?
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

8
345 points at 100% Donor Moderator Repute WDFplus Member
Wired, Admin and WDF Alien Overlord Home page   Private message  
Posted June 22 '09 at 02:19 PM
      Posts: 6,273
Why is that lol? How would you recommend getting files to a web server?
Admin at houseofhelp.com
WDF Resources: The Rules
Founder/Creator/Admin of ZE SECRET PROJECT!

Was another WDF member's post helpful? Click the positive rating button () above the post.

9
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 22 '09 at 02:25 PM
      Posts: 3,088
Danny,
Just curious what FTP program you're using.
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

10
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 22 '09 at 03:16 PM
      Posts: 777
my apologies wired. i just have a dif view of how to get things done sir. images go through form upload and code gets cut and paste into the new file. i dont need to reset permissions, dont have to rename its already named and no chance of overwriting, less security risk.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

11
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 22 '09 at 03:24 PM
      Posts: 777
ok keeping in mind not every project is a 500page site with 100 flash animations.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

12
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 22 '09 at 03:51 PM
      Posts: 11,793
Why is that lol? How would you recommend getting files to a web server?
Not applicable to most users, but here every site we put live is just a working copy of an SVN repository. We haven't needed to FTP things for our sites in years, although most of our clients give us big files via FTP (either their server or ours).

I have no idea why FTP ever had those two modes (binary and ASCII). Why everything isn't just in binary and preserving the linebreaks is beyond me. Who cares if the file you get from a server has different linebreaks in it?
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

13
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 22 '09 at 04:50 PM
      Posts: 777
hey fil can you give a link to some svn info or start a thread on it. i could use a laymen breakdown. also it is useful info to all i think from what i saw when i googled it.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

14
32 points at 100%
Posted June 22 '09 at 05:46 PM
      Posts: 76
Danny,
Just curious what FTP program you're using.

FileZilla

We're still using ftp on client's sites... basically just a small development site that the devs can all FTP into. We're just using it for File-Transfer only right now -- not too worried about versioning yet =) .

hey fil can you give a link to some svn info or start a thread on it. i could use a laymen breakdown. also it is useful info to all i think from what i saw when i googled it.
Google has the best repository I've seen and second to it is Source Forge... But I think SF still has that little clause that they can "charge" you or shut down your repository if you don't develop open source software (haven't read their rules in ages so don't bite my head off if they've changed it =P ).

Basically you get that setup and then winCVS set up the server details in it, and you're pretty much walking in the park.
Lead Web Designer
MLW & Associates, LLP.
W3C Standards Complaint and SEO Friendly
Admin of Vraul
Last edited June 22 '09 at 05:51 PM by Danny[MLWA]. Reply

15
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 23 '09 at 04:29 AM
      Posts: 777
thx danny
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

16
185 points at 100% Repute
aburningflame, Must... Post... More...! Private message  
Posted June 24 '09 at 03:47 AM
      Posts: 421
Theres nothing wrong with using an FTP client

anyways, the compilation bug has nothing to do with your PHP I ran into this problem many times in college.

I use Filezilla as my FTP client and Filezilla sometimes puts everything on 1 line, its very inconsistent. Once everything is on 1 line, the parser blows up.

This is NOT a php compilation bug, this is a bug in Filezilla that screws up the data transfer.

Update filezilla. If it still happens try toggling the transfer mode.
If it still happens, change FTP clients or setup a local php dev env.

Gluck

Post Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Top 21 PHP Programming mistakes thexchord PHP 18 Today 09:52 AM
PHP / Perl Coder Needed to Fix small Bug foodbiz Java and JSP 12 March 17 '07 06:07 PM
ASP .Net --> PHP echoSwe PHP 4 November 6 '04 06:12 AM
php vs. cfm gar598 PHP 1 April 2 '04 12:49 PM
Basic PHP Uploads Tutorial thexchord Coding Articles & Tutorials 2 May 2 '02 09:28 PM