-1

I just transfered a website to a new server; here is my sites conf (vhost) in nginx and the last 2 entries from error.log .

The images are not displaying when the index.php loads.

regars,


server {

    listen   80; ## listen for ipv4
    listen   [::]:80 default ipv6only=on; ## listen for ipv6

    server_name  maissane;

    access_log  /var/log/nginx/localhost.access.log;

    root   /var/www/alex.site.com;
    location / {
            index  index.html index.htm;
    }

    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9090;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

}

____________log errors:

2013/03/02 16:01:51 [error] 16637#0: *35 open() "/var/www/alex.site.com/images/right_<" failed (2: No such file or directory), client: 65.94.70.3, server: alex, request: "GET /images/right_%3C?=%20$theme;%20?%3E.jpg HTTP/1.1", host: "alex.site.com", referrer: "http://alex.site.com/index.php?p=bio"

2013/03/02 16:01:51 [error] 16637#0: *35 open() "/var/www/alex.site.com/favicon.ico" failed (2: No such file or directory), client: 65.94.70.3, server: alex, request: "GET /favicon.ico HTTP/1.1", host: "alex.site.com"

1
  • I get lots of errors in error.log:
    – Rich
    Mar 2, 2013 at 12:08

2 Answers 2

1

The log entry makes it pretty obvious.

You don't actually have a file /images/right<?= $theme; =?>.jpg.

Try providing a filename that exists.

2
  • There's a substitution that works on my other server. right_'ThemeName'.jpg Why wouldn't it substitute anymore properly?
    – Rich
    Mar 2, 2013 at 12:16
  • Who knows? Your question doesn't even address that issue. Perhaps you should look into it? Mar 2, 2013 at 12:17
0

As it seems the issue is in PHP config rather than nginx. Check your php.ini config for short_open_tag directive - it should be On, like

short_open_tag=On

or change the code to /images/right_<?php echo $theme; ?>.jpg.

Edit

As people point out, the usage of php short tags is not recommended for various reasons, one of which you are now experiencing(new server doesn't support them by default). See this SO thread for more info..
Thus the solution for you is to find all relevant occurences of <? and <?= and to replace them by <?php and <?php echo respectively.

5
  • Please don't use short open tags. Mar 2, 2013 at 12:38
  • @MichaelHampton you are right, i just explain the issue to OP.. Mar 2, 2013 at 12:39
  • I changed it to short_open_tag=On although the default value I believe is "On"...
    – Rich
    Mar 2, 2013 at 12:48
  • 2
    @Rich short open tags have defaulted OFF for many years. Their use is not recommended. Mar 2, 2013 at 12:50
  • Thank you; my bad. Not recommended because of conflicts with xml. Much appreciated!
    – Rich
    Mar 2, 2013 at 13:11

Not the answer you're looking for? Browse other questions tagged .