Category Archives: Linux/Unix

PHP Composer update command and Status: 404 Not Found on Linux server

Today I was trying to update Cakephp on my remote server using composer. I tried to follow the commands given at https://getcomposer.org/download/ under Command-line installation but it failed at the very first go. The command line code is:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

My server is a CentOS Linux release 7.4.1708 (Core) server with cpanel install. So, running the first command over there gives me the following error:

Error in argument 1, char 2: option not found r

Which clearly indicates the there is no r argument. If we check the above code in detail this is it tries to do:

  1. It tries to read the installer from give url https://getcomposer.org/installer and write it to a file named composer-setup.php
  2. If the file hash matches the given hash it tells user that install is verified otherwise it says that the Installer is corrupt and delets the file from server.
  3. Runs composer-setup.php
  4. Deletes composer-setup.php from server.

After doing all these steps it would let you run the following command in your directory you installed the composer in:

php composer update. However my method failed and then I found that the composer was already installed on my server at location /opt/cpanel/composer/bin. Since it was installed globaly and not under php php composer wont work at all.

Now if I ran composer update, because it was installed in teh given path it woudl show me the follwoing message:

Composer could not find a composer.json file in /opt/cpanel/composer/bin
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ “Getting Started” section

So all I need is to specify the correct path of my working directory. Doing this worked like a charmfor me:

composer update --working-dir /home/myproject/public_html/

Creating new virtual host while using Xampp in Ubuntu (Linux)

I need this stuff quite often. Every time i need to create a new virtual host in Ubuntu i have to google/search to find this solution as i cannot remember these paths properly. I am posting it here for quick reference for myself. Bookmark it for yourself (which i am going to do after i have finished posting it ;)) Continue reading

Broken jEdit FTP plugin fix after upgrading Ubuntu release

Just a note:

After upgrading my Ubuntu machine to latest Ubuntu 12.04 LTS version my preferred code editor started to have issues. I opened it as normal and it showed me 3 FTP connection windows at once and after closing these windows when i tried to launch a FTP profile from bookmarks it didn’t work and kept saying the “Already running command error”. I thought i needed to re-install the jEdit (the upgrade actually re-stalled the latest release of jEdit while upgrading) and tried a re-install but it did not fix anything. Then i removed the FTP plugin of jEdit and re-installed it and hurray, it works!

A tip on saving doc or docx files in LibreOffice

What i did i created a new .doc file through “Create New Document” that generally appears listed on pop up menu when one right clicks inside a folder area in Ubuntu. The file was created ok. Then i opened it in LibreOffice Writter, created a few lines and “bulletted” paragraphs with formattings, saved and closed the file. Continue reading

How to edit or download .htaccess from cpanel file manager where it is hidden

In my cpanel (dont know the version number) it didn’t show .htaccess file and hid it by default. If it happens and as a lazy person like me you dont want to do ftp like things to get the htaccess appeared on you,  just click on a visible file and open it in cpanel editor. It will give you the url something like below. Continue reading