Jump to content

Parse error unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR


Recommended Posts

Hello,

Sorry to be so rude and just turn up here,

But I am very pressed for time.

 

I tried to install your software on my webserver but I get these errors and I'm not sure why. Would someone here mind helping me out?

 

This one is from the index (/store)

Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/D/html/candycoreclothing/store/classes/Tools.php on line 23

 

And this is from the install (store/install)

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/D/html/candycoreclothing/store/install/classes/LanguagesManager.php on line 7

 

Thankyou so much for any help given :D .

Danny.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

This is absolutly php4 problem. Whe we try to install Pretashop on php 4.x than firstly we recognise our domain not forwarding  to install directory. So we are trying www.example.com/install but we saw parse error. There is two solution for this problem.

 

1. Your host must upgrade php 5.x

2. Using php5-cgi file

 

I am using php5-cgi and everything seems ok for now.  :D Because my host isn't changing or upgrading  php version for me :)  So a lot of person want to know how to use php5-cgi  ???

 

I have learnt this solution from another e-shop solution's forum.

Step by step application.

1- Download php5-cgi.zip from rapidshare ( http://rapidshare.com/files/113942560/php5-cgi.zip.html )

2- Extract the file

3- From your ftp software (filezilla,cuteftp ... ) login your file server

4- In the www root you can see cgi-bin directory but my best way is you to crate another CGI named directory.

5- Upload extracted file to that directory.

6- Create or change .htaccess file and write these codes.

 

# start code HTACCESS

<IfModule mod_php5.c>

    php_flag magic_quotes_gpc off

    php_flag short_open_tag on

</IfModule>

 

DirectoryIndex index.php

 

Action php5-cgi /cgi/php5-cgi

AddHandler php5-cgi .php

 

# URL rewriting module activation

RewriteEngine on

 

# URL rewriting rules

RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ product.php?id_product=$1$3 [L,E]

RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1$3 [L,E]

 

# Catch 404 errors

ErrorDocument 404 /404.php

# End Code HTACCESS

 

 

7- Than upload .htacces to your root directory

8- You can explore your domain (www.example.com) will forward www.example.com/install

 

I think everything will ok.

But then you have to read and manage standart prestashop installation steps.

Link to comment
Share on other sites

  • 1 month later...

Hello all,

I' ve tried all solutions given here, but still didn't manage to make it... it seems I didn't manage to switch to php5 although many attemps . My host is online.net and I tried their hotline . Their only answer ( helpfull ! lol ) was that if I didn't get php5 was because I didn' t manage to switch it on ! ( just great, when you don't need anything, just call them ! ).

There is probably something I am doing wrong, but I don't know what...can any one be kind enough to take the time to explain things to a poor little shop attendant who has two main defects :

She is no informatician

She is BLONDE !!!

Thank you ! ;-))

Link to comment
Share on other sites

Hello all,

I' ve tried all solutions given here, but still didn't manage to make it... it seems I didn't manage to switch to php5 although many attemps . My host is online.net and I tried their hotline . Their only answer ( helpfull ! lol ) was that if I didn't get php5 was because I didn' t manage to switch it on ! ( just great, when you don't need anything, just call them ! ).

There is probably something I am doing wrong, but I don't know what...can any one be kind enough to take the time to explain things to a poor little shop attendant who has two main defects :

She is no informatician

She is BLONDE !!!

Thank you ! ;-))



Eventually, I managed by MYSELF !!!! ( topic closed )
Link to comment
Share on other sites

  • 1 month later...

Just to clarify this issue in a simple way.

In your main prestashop folder, there is a file named htaccess.txt

Add the following in the very first line of the file.

SetEnv DEFAULT_PHP_VERSION 5



Now reupload the htaccess.txt file.

Now the file is on the server, rename that file to .htaccess

Note the . before it, and also remove the extension .txt from the end.

Hope this helps anyone who isnt that familiar with htaccess files.

Link to comment
Share on other sites

  • 3 weeks later...

Ok,

I am new to Prestashop as I have always used OSC. However, I decided to learn more about PrestaShop because of the nice GUI that would allow my customers to access the admin side and make their own changes easily.

My problem is, I am still getting the Parse error even after making the changes suggested in this thread. If I alter the .htaccess file it comes up with an error 500 (internal server error) when I try to install Prestashop.

Is anyone else using godaddy.com to host a prestashop ? if so, was there anything special needed ???


Thanks in advance.


Chris

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

the posted solutions did not work for me


I am at 1&1;and it is PHP 5


i uploaded htaccess:

AddType x-mapp-php5 .php4
AddHandler x-mapp-php5 .php4


and also tried this:

SetEnv DEFAULT_PHP_VERSION 5
# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php



same error

/install/classes/LanguagesManager.php on line 7





i have a Magento store working on the same server so Im not sure its as easy as blaming 1and1.

Link to comment
Share on other sites

I am hosted with 1&1;. I have a shared package.

Here is info for changing to php5.

http://faq.1and1.com/scripting_languages_supported/php/upgrade/6.html

It says

By default Apache uses PHP 4 for .php extension. If you don't want to rename all your
scripts to .php5 you can do the following:
Create a .htaccess file and place the following line AddType x-mapp-php5 .php in it.

This will tell Apache to use PHP 5 instead of PHP 4 for the extension .php in the
directory the .htaccess is placed and all sub-directories under it.
Link to comment
Share on other sites

  • 4 months later...

Hello,

After installing Prestashop successfully on my personal website (@ Amen.fr) I'm trying to do this for a client who is at Thunderhosting.org.

PHP is 5.2.9 as per the general server information. I could not get past the "parse error unexpected T_STATIC… error, until I changed the .htaccess file to:


AddType x-mapp-php5 .php

# URL rewriting module activation
RewriteEngine on



# URL rewriting rules
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

That got rid of the error, now I get an installation window with lot's of code (see jpeg) and have no clue as to what is to be done now! I would be thankful for your suggestions!

Thanks,

Tarek

7502_hKGznBV7ahmAqQDgllFG_t

7503_SYQ1cQOfK6tqekYJWetW_t

Link to comment
Share on other sites

:-) I found the answer to my problem.

It seems that although Thunderhost.org indicates php 5 as active, the default is php 4.

My cpanel configuration (or version) did not allow the end user to change the php configuration - this has been changed ovrnight. Everything works as expected.

Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...

I get this error when trying to install a module, it could be that I am trying to write the module and doing something wrong


Parse error: syntax error, unexpected T_STRING in /home/chrellis/public_html/classes/Module.php(325) : eval()'d code on line 49
Parse error(s) in module(s)

1. socialbookmarks


I did check to make sure that php 5 is installed a correctly working and it is

Any ideas or am I in the wrong thread for this problem?

Thanks
Link to comment
Share on other sites

  • 3 months later...

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\AppServ\www\pshop\install\classes\ToolsInstall.php on line 4

I got an above error when I install the program.

I have checked my php version is MySQL client version: 3.23.49
Server version: 5.0.45-community-nt-log

Can any tell me what the problem is?

Thanks a lot
Steve

Link to comment
Share on other sites

  • 8 months later...
  • 3 weeks later...

Hi

I get this error aswell and have tried everything I have found but whitout success.
Cleared cookies.
Have php5
I cant see the .htaccess or the cgi bin on the server, that might be a problem?

Anyone else have any ideas?

regards

Link to comment
Share on other sites

  • 5 months later...

Hello,

Sorry to be so rude and just turn up here,

But I am very pressed for time.

 

I tried to install your software on my webserver but I get these errors and I'm not sure why. Would someone here mind helping me out?

 

This one is from the index (/store)

Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/D/html/candycoreclothing/store/classes/Tools.php on line 23

 

And this is from the install (store/install)

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/D/html/candycoreclothing/store/install/classes/LanguagesManager.php on line 7

 

Thankyou so much for any help given :D .

Danny.

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_FUNCTION in /hermes/bosnaweb03a/b2758/ipg.delhibrandscom1/override/classes/Dispatcher.php on line 26

 

 

I'm getting this error after install and uninstall one module. 'cleanurl'

 

 

Any suggetion? 

Link to comment
Share on other sites

  • 2 years later...

This is a well known bug/situation in PrestaShop.PrestaShop tries to manually copy class methods to \override\classes\* files, and sometimes the lines miss-match or the line break are wrong, and the end result is incorrectly copied lines which cause syntax errors. That happens both on installation and uninstallation.

you need to rename the file Dispatcher.php to Dispatcher.php_ORIG and your application will work as intended. 

Please clear your browser's cache and verify on your end. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...