VPS, PHP, WordPress & image upload issues

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Uploading a new WordPress site to my VPS (Virtual Private Server) became a bit of a problem a couple of months ago. I was trying to set up a simple template site for my Son-in-law for a woo-commerce product site. Unfortunately my VPS did not want to do so, even using the Microsoft web platform installer.

Because it was nothing obvious, it kept on saying PHP was not running, I decided to leave it and go to a free site to install a WordPress test site. I had a bit of a play around at the time and couldn’t resolve the issue. I would come back to it later.

It is now later, and I spent a lot of yesterday tidying things up on the server. I seemed to have a few versions of PHP running so I updated to latest and pointed everything to that.

In ISS I did not have PHP manager on the Server, so I loaded that up too.

WordPress install

WordPress was going partially through the install, creating a Database, but then not population it with any tables, so I cleaned all of those redundant databases out.

I think I had issues with the number of Web sites on port 80, I had about 10 ish. So I wondered if using a different port might help, so I used port 8085 (I initially tried port 8081 and 8082.

I was focusing on a clean install of WordPress, then I’d get a Domain from Freenom and associate it with the site. I finally got a clean install with the port 8085 (still no actual domain linked to site) and when I got the domain it kept on pointing to www.xxxxx.tk/8085 and that didn’t look pretty, but the wordpress site was up.

I then tried switching this new site to port 80 with another blank site I had running , but that didn’t work. I had to go into the web.config file that sites in the WordPress root directory and edit that as it kept adding the 8085 on the end.

The next day the DNS had propagated across the net and I could get to the http://xxxxx.tk site via the web browser.

Full width WordPress site

This was something I wanted to do. I am generally happy with the standard site, but all the professional sites are usually full width, so I wanted to set this up for the site. I was following the tutorial below before I ended up with an image upload issue:

Image upload issue

I’m currently trying to resolve this. Its driving me cracked. It seems to come about through poorly formatted PHP setup.Using command line > php -info

I just found out its pathing to an earlier version of PHP so its not got the path to a temporary added a directory. I’ve just removed that from the path, so hopefully it points to the latest and will load the php.ini file with the temp path.

This is affecting all of my  sites now so its a bit of a major.

I added a temp directory and pointed to the directory in php.ini but that didn’t work. Then I found that there was already a temporary file in the ini file at the bottom already. So I went back to the original one as it was.

Looking into the PHP directory I saw that all the .dll files were blocked. In Explorer you have to select the file and right click and go to properties and tick the unblock box. This can only be done one file at a time, so very tedious.

I found an article where you can do this in Powershell, I used that and it did a great job:

Apparently to restart PHP you have to get command prompt and type >IISReset (enter)

This closes down the ISS and restarts it, hopefully rebooting PHP along the way. I found a little script file that you can call from browser, so you need to put the file in your root directory of a web page , eg https://cr8ive.cf/wheretemp.php (file’s not actually there) and in it

<?php 
echo "hello";
// Create a temporary file in the temporary 
// files directory using sys_get_temp_dir()
$temp_file = tempnam(sys_get_temp_dir(), 'Tux');
echo $temp_file;
?>

I put the echo “hello”; in as there was just blank when I ran the file. The addition does indicate that the file is running, but still cannot find a temp directory. Even after reboot of Server. Same issue.

So, I have temporary path in Windows. This seems to be a no-no. It is set by default at the bottom of the PHP.INI file and doesn’t work. As soon as I re-pathed it to say C:\inetpub\wwwroot\Temp it worked perfectly and all the imiges loaded fine.

One thing I found, in the bottom of the PHP.INI file was an error log, and looikng inside that was not a massive amount of help but it gave a few pointers. This issue has consumed about 4-5 hours of my time.

The posts on fixing this were not that great. I ended up looking through about 30 before I finally found one that told me not to put in the C:\Windows\Temp directory, although the error log was being sent there quite happily.

Maybe now I can get back to trying to make a full width web site.

Add a Comment