Weird PHP Parse / Syntax errors with VMWare 6.5 + PHP 5.3.3 + Symfony 1.4

Following the course "Practical Symphony", I came across a strange mistake.

I installed Debian Squeeze on a VMWare 6.5.5 machine. It comes with PHP 5.3.3 and I am using Symfony 1.4. The source files are on the host, I access them using the shared folder function (vmhgfs mount).

Now, when I try to execute the following commands, I get an error message:

php symfony doctrine:build --model php symfony doctrine:build --sql 

Mistake:

 PHP Parse error: syntax error, unexpected ')' in /var/www/appli/lib/model/doctrine/base/BaseJobeetJob.class.php on line 144 

Which is funny when I: - do the same thing without shared folders (for example, on the ext3 partition), it works, - convert the virtual machine to VirtualBox and do the same in the shared folder, it works, - downgrade PHP to 5.2.6 (from lenny), it works.

I remember that I had the same problem some time ago with PHP code created by Smarty. Since it was automatically generated by PHP and can be regenerated at its discretion, I generated it in a local directory. But I do not think this applies to the generated Doctrine files.

Does anyone know what is happening and how can I fix it?

EDIT: here is the code around line 144:

  public function setUp() { parent::setUp(); $this->hasOne('JobeetCategory', array( 'local' => 'category_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); $timestampable0 = new Doctrine_Template_Timestampable(); $this->actAs($timestampable0); } } // Line 144 here. 

This is actually the end of the file ...

EDIT # 2: for clarity to be verified, I checked the following combinations to narrow down the problem:

  • VM Software: VMWare 6.5.5 / VirtualBox 4.0.8 Workstation
  • PHP Version: 5.3.3 /5.2.6,
  • Mount Type: vmhgfs (or vboxsf with VirtualBox) / ext4 (local) / cifs (also known as the Windows share).

In each case, I use the same source files (but for ext4, because I had no choice but to copy them). I have a crash when combining bold items. If I change any of them, everything will be fine. I also tried using open vm modules instead of the provided vmware tools and building a Debian installation from scratch instead of using my own automated script, but didn't change anything.

+8
php symfony1 vmware-workstation doctrine
source share
6 answers

This seems to be a bug in vmhgfs - I have the same problem as with the Drupal PHP code. This also happens only when files are added to the host from a guest, for example, using git to clone a repository in a Linux virtual machine.

There are three workarounds:

  • Copy the files to the desired location, then disable the shared folders in the VMWare settings for the virtual machine, refresh the web page to get “Not Found,” and then turn on the shared folders again.

  • On the host machine, run the following command, which updates the file access timestamps / modified timestamps for each file, causing the VMWare driver to reload the file, fixing the problem:

     find . -exec touch {} \; 
  • Open the damaged file from the host computer, modify it and save. This can be useful if you are on a Windows machine.

Errors range from PHP Parse errors to others, usually marking the last line of a file.

+8
source share

I have the same problem on OpenSUSE 11.4 with PHP 5.3.5 using vmhgfs (on Mac). I also use the doctrine, however I use it without a full symfony project.

Initially, vmhgfs did not work at all, so I downloaded the open vm tools and compiled / installed them. This solved my problem in a few weeks, but it came back today.

The problem is reading php beyond the end of the file. If I read the file with cat, less or tail, then the end of the file will look fine.

tail of bad file

But if I do php -s bad_file.php > bad_file.php.html and look at the html output, I can see that there is extra garbage at the end of the file that I cannot see with cat, less or vim.

php syntax highlighting of bad file

You can see that php sees "array (" at the end of the file, while other tools do not.

The only solution I found was to manually add a new blank line at the end of each problem file. For some reason, it affects only 1-2 files out of about 40.

+3
source share

Same problem. I confirm that this is vmhgfs problem. A workaround is to use the NFS share instead of the vmware shared folders:

Linux env

 apt-get install portmap nfs-common nfs-kernel-server mkdir /nfs-share1 echo "/nfs-share1 192.168.2.1(rw,sync)" >> /etc/exports /etc/init.d/portmap start /etc/init.d/nfs-kernel-server start /etc/init.d/nfs-common start usermod -u 501 paolo find / -user paolo -exec chown paolo {} \; 

OS X env

 showmount -e 192.168.2.129 mkdir /Users/paolo/netshare1 mount -t nfs -o resvport,soft,intr,rsize=8192,wsize=8192,timeo=900,retrans=3,proto=tcp 192.168.2.129:/nfs-share1 /Users/paolo/netshare1/ 
+1
source share

Ugh! I finally figured it out. I use VMware Fusion (4.0.2) on Mac OS X Lion (10.7.2) and I am pulling my hair out trying to figure it out.

Upgrade Your VMware Tools!

So far so good: have not encountered the problem again. The latest version at the moment is VMware Tools 8.0.0.

+1
source share

Well, this may not be the topic, but I hope this helps:
I am working on the same book and I did this (I think you better do something like me):

  • Installed Ubuntu Server Inside VirtualBox
  • Installed LAMP server on Ubuntu
  • Installed vsftpd, for ftp access on Ubuntu
  • An SSH server is installed on Ubuntu.

Now, if I'm on a Linux host, I use Aptana Studio with ftp access to edit files and SSH to run commands, and if I'm on Windows, I use Aptana Studio and Putty to access SSH.

If you do something like this, you probably will not be difficult. Hope this helps.

0
source share

I also experience this issue with Wordpress and Laravel. To fix this problem, I have to remount the installed folder from the guest.

For example, all of my source files are hosted (OSX) and transferred to Ubuntu (guest) using vmhgfs. Mount point - / mnt / hgfs / www. To remount:

 sudo mount /mnt/hgfs/www 
0
source share

All Articles