VS Code Delete Every Other Line

June 8, 2018 Tags Programming, Fixes

For some reason, after having edited a file in cPanel's online code editor, when I downloaded said file to my local machine it had empty lines added after every existing line. Of course, this was very ugly and made the file double the length in the editor.

Anyway, here's a quick guide on how to remove these extra lines.

  1. Press ALT+H to open the replace box (top right).
  2. Make sure Regex is enable by clicking the dot+star icon. It will add a color border to it.
  3. Enter (.*)\n\1\n in the search box.
  4. Enter $1\n in the replace box.
  5. Hit replace all, and you're good to go!

cPanel FTP Failed - Unable to connect to port 21 on 127.0.0.1

May 24, 2018 Tags Programming, Fixes, cPanel

So I woke up to numerous emails from the cPanel Monitor service telling me that the ftpd service was offline. I tried various ways to restart the service but it just wouldn't start, I kept getting the same error message:

warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.
Waiting for “pureftpd” to restart …………Waiting for pure-ftpd,pure-authd to shutdown ....... terminated.
warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.

…warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.

…failed.

Cpanel::Exception::Services::StartError
Service Status
pure-ftpd (/usr/sbin/pure-ftpd [...]) is running as root with PID 18545 (systemd+/proc check method).

Service Error
(XID fhx2ad) The “pureftpd” service failed to start.

Startup Log
May 24 13:41:45 [...] systemd[1]: Started Pure-FTPd.
May 24 13:41:45 [...] systemd[1]: Starting Pure-FTPd...

pureftpd has failed. Contact your system administrator if the service does not automagically recover.

I checked CSF Firewall to see if that was somehow blocking the port, I updated the server's plugins and ran a manual cpanel upgrade but nothing worked.

Well, it turns out the culpret is an option in the /etc/pure-ftpd.conf config file.

If you're having issues with PureFTPD and cPanel, check if CallUploadScript is set to yes by running this command in shell:

grep Call /etc/pure-ftpd.conf

If you see "CallUploadScript yes" then you need to disable it as it turns out that when trying to start the pureftpd service it attempts to start the pure-uploadscript service but it wont work. Simple fix is:

vi /etc/pure-ftpd.conf

Find the line that says CallUploadScript yes and change it to no.

Restart ftp service and you're good to go!

 

Prestashop: Correct File Permissions

April 3, 2018 Tags Programming, Fixes, Prestashop

I noticed, after uploading Prestashop to my webserver and extracting the files, I was getting 500 Internal Server errors. After a bit of testing I figured out the file permissions from having extracted the files were actually incorrect. Directories need to be set at 755 while files should be set at 644.

To save time, I SSH'd into the server and ran these commands after navigating to the public_html folder (or www folder):

chown www-data:www-data  -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

That should assign the correct user to the files, and permissions as well.

Prestashop: Open the Sample CSV Import Files in Excel

April 3, 2018 Tags Programming, Fixes, Prestashop
prestashop-open-the-sample-csv-import-files-in-excel

I was having trouble opening the sample CSV files that Prestashop provides for doing mass object importing, turns out it was simply because the sample files are separated by semicolon instead of by comma. The very easy fix is to open the CSV file in a text-editor and adding the following line to the beginning of the file:

sep=;

Doing this tells Excel that you want to use the semicolon caharacter as seperator.