PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label plesk. Show all posts
Showing posts with label plesk. Show all posts

Monday, November 14, 2022

[FIXED] How to limit plesk user with SSH access only to his own webspace

 November 14, 2022     chroot, permissions, plesk, ssh     No comments   

Issue

I have created a Parallels plesk panel webspace and allowed SSH access:

  1. In plesk go to the webspace
  2. Websites & domains tab
  3. Web hosting access
  4. In Access to the server over SSH select /bin/sh

I connected by SSH and I realised I can go everywhere in the server and create files.

I would like to limit the SSH access just to the user directory.

I read about chroot. Do you think it is the solution? There isn't a way to configure directly in Plesk?


Solution

It was as easy as select:

Access to the server over SSH: /bin/bash (chrooted)

enter image description here



Answered By - Mikel
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Where is httpd.conf file of a domain? (Plesk, Apache, CentOS, Dedicated Server.)

 November 14, 2022     apache, centos, dedicated-server, plesk     No comments   

Issue

I'm trying to disable access logging (access_log) for domains. I can't find a way to do it yet, I thought if httpd.conf file exist of a domain maybe I can look into that. So do you know where is httpd.conf file of a domain?


Solution

Try

locate httpd.conf 

on the commend line. Note that in newer Apache setups, the configuration is spread across multiple files, but they won't be far from where you find httpd.conf.



Answered By - Pekka
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I use Let’s Encrypt with GitLab under Plesk on Subdomain?

 November 14, 2022     gitlab, lets-encrypt, plesk, ssl-certificate, subdomain     No comments   

Issue

I got GitLab up and running, but currently it doesn't use SSL. I use the Let's Encrypt Plesk Extension to get free SSL Certificates in general. This is what my setup looks like:

  • Plesk v12.5.30_build1205150826.19 os_Ubuntu 14.04
  • GitLab 8.8.5
  • Let's Encrypt Plesk Extension v1.6 Release 1
  • Plesk Subdomain: git.my-domain.com

Plesk Apache & nginx Settings for git.my-domain.com:

Additional directives for HTTP :
<Location />
    ProxyPass http://IP-of-my-domain:9999/
    ProxyPassReverse http://IP-of-my-domain:9999/
</Location>
Additional directives for HTTPS :
<Location />
     ProxyPass https://IP-of-my-domain:9998/
     ProxyPassReverse https://IP-of-my-domain:9998/
  </Location>

In my gitlab.rb file:

external_url "http://IP-of-my-domain:9999/"

I also found How do I use let’s encrypt with gitlab? and tried to adapt the answers but couldn't figure out what to put into:

nginx['custom_gitlab_server_config']="?"
nginx['custom_gitlab_mattermost_server_config']="?"

Http connection is working flawlessly (Subdomain or IP:Port, both work). As soon as I change to Https it doesn't and I get the following (also if I change external_url to port 9998):

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

Certificate was installed before the ProxyPass and https works without any problems without the ProxyPass entries (i.e. the certificate exists and is valid).

If anyone got Plesk and GitLab with Let's Encrypt up and running, I would really appreciate if you could share your configuration.


Solution

I created symlinks in /etc/gitlab/ssl to my certificates

  1. subdomain.domain.tld.crt => /opt/psa/var/modules/letsencrypt/etc/archive/subdomain.domain.tld/cert1.pem

  2. subdomain.domain.tld.key => /opt/psa/var/modules/letsencrypt/etc/archive/subdomain.domain.tld/privkey1.pem

In file gitlab.rb

external_url 'https://gitlab.domain.tld'
gitlab_rails['gitlab_shell_ssh_port'] = 22 
gitlab_rails['initial_shared_runners_registration_token'] = "token"
web_server['external_users'] = ['webUser']
nginx['enable'] = false  # Tutorial
nginx['redirect_http_to_https'] = true      
nginx['listen_https'] = false

In Plesk: Domain => Apache & nginx Settings => Additional nginx directives

 location ~ / {
        # for omnibus installation
        root /opt/gitlab/embedded/service/gitlab-rails/public;
        try_files $uri $uri/index.html $uri.html @gitlab;
    }

    # if a file, which is not found in the root folder is requested,
    # then the proxy pass the request to the upsteam (gitlab unicorn)
    location @gitlab {
        proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_redirect     off;

        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-Real-IP         $remote_addr;

        proxy_pass http://gitlab;

    }

In file gitlab.conf

  upstream gitlab {
        # for omnibus installation
        server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
    }


Answered By - Eskaaa
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I disable https on my webserver using Plesk?

 November 14, 2022     centos, php, plesk, server     No comments   

Issue

I've got a CentOS server running Plesk 17, when I disable SSL/TLS Support in the hosting settings for my webisite, the document root changes to /var/www/vhosts/default/htdocs instead of staying with the one set /var/www/vhosts/example.org.

I'd like to disable completely https and redirect everything to http, does anyone know how to accomplish such a task?

Thank you.


Solution

Well, actually you can't redirect from HTTPS to HTTP when HTTPS is disabled.

When you disable HTTPS for domain.tld and you trying to open https://domain.tld this request will be catch by Default Virtual Host which document root is /var/www/vhosts/default/htdocs

Yes, you can place in this document root .htaccess with redirect rules but any user will see SSL Certificate Error first and in most of the cases will not continue to open such site.

To perform redirect from HTTPS to HTTP domain should have enabled HTTPS with valid SSL certificate, only in this case you can redirect user to HTTP.



Answered By - Oleg Neumyvakin
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why would logging of PHP errors stop?

 November 14, 2022     apache, nginx, php, plesk     No comments   

Issue

Using Plesk with Apache and Nginx together on Centos.

Errors were being logged perfectly on;

/var/www/vhosts/example.com/logs/error_log

/var/www/vhosts/example.com/logs/proxy_error_log

I truncated the files by deleting and recreating them; now nothing is logged. File owner and the file permissions are all the same; but error logging has just stopped.

I check the other domains, they all perfectly work as supposed.


Solution

Actually web server logs are stored in /var/www/vhosts/system/example.tld/logs/.

Log files in /var/www/vhosts/example.tld/logs/ it's not a files but hardlinks to files in /var/www/vhosts/system/example.tld/logs/. Pay attention for same inode number 261064:

# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

when I've remove this file I've remove hardlink:

# rm /var/www/vhosts/example.tld/logs/error_log
rm: remove regular file `/var/www/vhosts/example.tld/logs/error_log'? y
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 1 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

When I've create it again it will has own inode number(276777):

# touch /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
276777 -rw-r--r--. 1 root root 0 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log

So to solve you issue you just need to remove file you have created and create hardlink to file in system/log:

# rm /var/www/vhosts/example.tld/logs/error_log
# ln /var/www/vhosts/system/example.tld/logs/error_log /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log


Answered By - Oleg Neumyvakin
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I return a Plesk API XML package into an array

 November 14, 2022     api, arrays, packet, plesk     No comments   

Issue

I am using plesk api to return informaton from plesk. It gets put into an xml string eg

$response = $client->request($request);

The string has this information in

<database>
<get-db>
<result>
<filter-id>domain name</filter-id>
<id>34</id>
<name>database</name>
<type>mysql</type>
...etc snip
</result>
<result>
<filter-id>domain name</filter-id>
<id>36</id>
<name>database</name>
<type>mysql</type>
...etc snip
</result>
</get-db>
</database>

What I want to put the result into a 2 dimensional array.

I want the first to be name and I also need the id

I have tried using preg_match to get the tags, but for some reason I am only getting the first tag. And of course the function isn't putting it inside a 2 dimensional array yet.

function tags($string, $tagname)
{
    $pattern = "#<\s*?$tagname\b[^>]*>(.*?)</$tagname\b[^>]*>#s";
    preg_match($pattern, $string, $matches);
    return $matches;
}

This is so I can match the name and get the id you see.

I am editing because I have just found something that might help, but I haven't worked it out yet

$xml=simplexml_load_string($response) or die("Error: Cannot create object");

I think this is for parsing xml, but can't seem to get it parse my xml package properly.

Also tried this

$data = simplexml_load_string($response);
echo $data->result[0]->name;

But this doesn't seem to work.


Solution

I have solved this now

$response = $client->request($request); // Send query to Plesk host
echo $response; // show response

$xml = simplexml_load_string($response);


echo $xml->database->{'get-db'}->result[0]->name;
// This gets the first tag called name

//This loops through and gets every tag called name
foreach ($xml->database->{'get-db'}->result as $result)
{
   echo '<pre>'.$result->name.'</pre>';
//If I want to now I can put this result into an array here, but I find I do not need to now. As I only want to find the id of a matched database. So no array needed now, as I can use this loop
}


Answered By - Thomas Williams
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, November 13, 2022

[FIXED] How to catch all subdomains in plesk

 November 13, 2022     plesk, wildcard-subdomain, windows-server-2012     No comments   

Issue

How to catch all subdomains in plesk which installed in windows server 2012 ?
I founded answer for Linux servers but not same config file and other settings in windows.

I want catch all subdomains like *.domain.com in one file like domain.com/t.asp which can detect entered subdomain in this file, and address in browser not change to this file address and show same *.domain .


Solution

insert an "A" DNS entry on your primary nameserver of your domain.

*.domain.com    A         XXX.XXX.XXX.XXX


Answered By - MohsenB
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how to find out which version of asp my website is coded in

 November 13, 2022     asp.net, c#, plesk, server     No comments   

Issue

I have a website which is coded in asp. We have upgraded out plesk server from plesk 9 to 12 since then, I am getting a "Internal server error".

It could be that the new version of ASP installed on Plesk is not compatiable with the version of ASP that the website is coded in. Right now we do not have the website only the code, so is there a way to find out which version my ASP code is coded in just so that I can install an older version of ASP on my server to get the website back up and running?

Thanks.


Solution

Open your project in visual studio. once your project is loaded in visual studio click web config file in that you can find .Net framework version.



Answered By - Prasanna Murali
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why (non existing) subdomain of my add-on domain redirecting to primary domain?

 November 13, 2022     .htaccess, laravel, plesk, server, subdomain     No comments   

Issue

I am using 1and1 cloud with plesk.

I have a http://primary.com and an http://addon.com

Right now if if some one enter any none existing subdomain e.g. blabla.addon.com, the URL in browser address bar stays the same but contents coming from http://primary.com/

I wanted contents to come from http://addon.com

Can anyone please guide me to the right direction?


Solution

This happens because by default Plesk will serve it's "Web Server's Default Page" template.

If you want to change this behaviour you need to set a default domain that will be served instead.

The setting you are looking for is located at:

Tools & Settings > IP Addresses > Your IP (click) > Default site > Domain (addon.com)



Answered By - uu01
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to install Django on shared hosting server with Plesk?

 November 13, 2022     django, plesk, python, shared-hosting     No comments   

Issue

My question is: how can I install DJANGO on a shared hosting account?

My hosting supports PYTHON 2.4. After copying the files to the ftp server, what is the next step? On Django site it says you need to to this:

tar xzvf Django-1.3.tar.gz
cd Django-1.3
sudo python setup.py install

But I dont see any command shell on my plesk account admin page. Now, there is an option on my hosting provider that gives what they call "SSH chrooted shell access with a limited command set" for €60 euros more.

Do I need to get that shell access upgrade for Django/PYTHON development?
Thanks very much!


Solution

You could use a "django ready" hoster (eg google apps)!

here's an collection of links https://code.djangoproject.com/wiki/DjangoFriendlyWebHosts



Answered By - enthus1ast
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to access the font programmatically

 November 13, 2022     asp.net, c#, fonts, gdi+, plesk     No comments   

Issue

I'm trying to access to a font programmatically, because i cant install fonts on the sharing hosting

I use this code

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    Dim collection As New PrivateFontCollection()
    collection.AddFontFile(Server.MapPath("~\ShadowsIntoLight.ttf"))

    Dim image As New Bitmap(500, 500)
    Dim g As Graphics = Graphics.FromImage(image)

    Dim RedBrush As New SolidBrush(Color.Black)
    Dim drawFont As New Font("Shadows Into Light", 36)

    g.DrawString("the lazy fox jumped over the brown log", drawFont, RedBrush, 0, 100)

    Dim path As String = Server.MapPath("~/image.png")
    image.Save(path, ImageFormat.Png)
    g.Dispose()
    image.Dispose()

    Response.Write("<img src=""image.png""/>")

End Sub

but it always displays the Arial font. How can I make it display the specific font

Thank you


Solution

Could you not use CSS in the background? Add the custom font to your solution in a 'Fonts folder' > add existing item to fonts folder in visual studio

Example: (Using a random font I downloaded)

@font-face{
font-family: myFont;
src: url(/Fonts/Belleza-Regular.ttf);

}

.MyClass{
color:green;
font-family: myFont;
 }

Then append this font anywhere within your code?

myControl.CssClass = "MyClass" etc..



Might be a slightly longer way than you wanted and would only work if you're appending to controls and such however might be a nice workaround.

Edit:

maybe something like this? Using custom TTF font for DrawString image rendering



Answered By - dan6657
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how io update tomcat 8 in Plesk Onyx Version 17.5.3 windows

 November 13, 2022     java, plesk     No comments   

Issue

we install tomcat 8 directly using RDC in c drive and deploy war file in webapps dir and it worked fine but we have to append port no after domain name (ex www.example.co.in:8080/NewProject/) to work.

In plesk our installed tomcat 8 is not appear on list of tomcat server.

either i want tomcat 8 option display in list or we dont need to append port number after domain.


Solution

Tomcat 8 is not supported by Plesk 17.5.3 according to Software Requirements - https://docs.plesk.com/release-notes/onyx/software-requirements/#s4-1-2



Answered By - IgorG
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to write a file ussing PHP schedule task in PLESK ?

 November 13, 2022     cron, php, plesk     No comments   

Issue

I am trying to write a file in my VPS server. I am using a simple script who works perfectly in my localhost, but not running as PLESK scheduled task.

PHP scripts is as follows

<?php
$fileUrl = 'http://xxxxremotefile.kml';
$saveTo = 'myfile.kml';

$fp = fopen($saveTo, 'w+');
if($fp === false){
    throw new Exception('Could not open: ' . $saveTo);
}
$ch = curl_init($fileUrl);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_exec($ch);
if(curl_errno($ch)){
    throw new Exception(curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($statusCode == 200){
    echo 'Downloaded!';
} else{
    echo "Status Code: " . $statusCode;
}
?>

The script runs. No error, but no file writed.

What am I doing wrong?


Solution

Can you set absolute path for the $saveTo and check ? Example,

$saveTo = '/home/myfile.kml';


Answered By - Iynga Iyngaran Iyathurai
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to set up a cron task in Plesk every 15 minutes?

 November 13, 2022     cron, plesk, task     No comments   

Issue

I'm a total newbie with Plesk, and I'm wondering how to set up a cron task for executing http address, which is updating profiles. I have my link of course, and I want to run this link every 15 minutes, 24 hours a day, non-stop.

I'd be very glad if you guys could help me with that.

Here's my cron task configuration for root:

cron task configuration

What should I fill in minute, hour, day? And how about command?

Thanks for helping me, Mike


Solution

It's not quite clear what do you mean under "executing http address"

But you can try this setting

Since Plesk 12.5 there are task options:

plesk cron job scheduling task

In Plesk 12 and below:

plesk 12.0 cron task setup



Answered By - Oleg Neumyvakin
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to install Plesk on Ubuntu 16.04

 November 13, 2022     failed-installation, installation, plesk, plesk-onyx, ubuntu-16.04     No comments   

Issue

I am getting this error on my Ubuntu 16.04 LTS system :

The following packages have unmet dependencies:
plesk-php56-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php70-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php71-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php72-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed

output of lsb_release -a :

Distributor ID: Ubuntu

Description: Ubuntu 16.04.3 LTS

Release: 16.04

Codename: xenial


I tried a lot of things , installed a lot of packages, stopped some services but can't resolve. I have 3 domains and will add some more too , so I want to use plesk for easy configurations, but can't install. How can I install plesk on my system?


Solution

It seems that you encountered system repositories misconfiguration. Plesk requires that the system repositories were enabled.

For experiment sake I installed OS from official ubuntu-16.04.3-server-amd64.iso with default settings (just enter-enter-enter):

# cat /etc/*release | grep VERSION
VERSION="16.04.3 LTS (Xenial Xerus)"
VERSION_ID="16.04"
VERSION_CODENAME=xenial

Then Plesk Onyx 17.8 (which is currently default) using one-click installer.

Installation went successfully. I can see, that mentioned packages depends on libsnmp30, but not the specific version:

# apt-cache depends plesk-php56-snmp
plesk-php56-snmp
  Depends: libc6
  Depends: libsnmp30
  Depends: plesk-php56

However, the version which you were missing was already installed:

# dpkg -l | grep libsnmp30
ii  libsnmp30:amd64                    5.7.3+dfsg-1ubuntu4.1                      amd64        SNMP (Simple Network Management Protocol) library

It comes from xenial-updates main repository, which is enabled by default:

# apt-cache showpkg libsnmp30 | grep  4.1 | grep binary-amd64
5.7.3+dfsg-1ubuntu4.1 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_binary-amd64_Packages) (/var/lib/dpkg/status)

Just in case, here is my sources.list:

# cat /etc/apt/sources.list | grep -v "^#"
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse


Answered By - Elvis Plesky
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to upload Java archive (.WAR) to Windows Server on Plesk?

 November 13, 2022     java, plesk, war, windows-server     No comments   

Issue

I am able to create a .WAR archive of my Java project from Eclipse. This is what I tried:

Plesk Home Page -> Domains -> example.com -> Java Applications -> Install Java Application

But when I click The Install Java Application button it shows this warning:

Error image

Please help me, anything will be appreciated...


Solution

That means that while Tomcat feature is available for your subscription, the current limit for Java application is 'zero'. Contact your server provider to sort it out. If you are a server owner, login into Plesk and check the following:

  1. Plesk license allows creating resources of this type (Tools & Settings > License Management).
  2. Subcription service plan has enough resources (Subscriptions > example.com > Service plan).
  3. If the subscription is locked check the customized resources (Subscriptions > example.com > Customize).

If the subscription assigned to the customer created by reseller, then verify reseller's resources availability:

  1. Reseller' service plan has not enough resources (Service Plans > Reseller Plans).
  2. If the reseller' subscription is locked check the customized resources (Resellers > My reseller > Customize). Locked state means locked for syncing, indicates that a subscription is excluded from syncing with the associated plans.

A subscription gets locked parameters of the subscription are changed without changing the associated service plan. Such locking secures the customization so that they are not overwritten the next time, when the plan parameters are changed and all its subscriptions are synced.

Unsynced state indicates that some services or resources offered with the associated plans cannot actually be provided with the subscription.



Answered By - Elvis Plesky
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I create a subsubdomain.subdomain.domain.com

 November 13, 2022     domainservices, multiple-domains, plesk, subdomain     No comments   

Issue

I want to create something like console.firebase.google.com, I am currently using Plesk Web Admin Panel, and I want to create a subdomain for the subdomain which will be example.example.example.com

How is that possible Thanks


Solution

  • Create the main domain example.com and create the subdomain example.example.example.com by adding example.example. Or:
  • Create the main domain example.example.com and create the subdomain example.example.example.com by adding example. Or:
  • Create the main domain example.example.example.com.

As per Plesk logic, it is possible to create "subdomain" object only for the "main domain". There cannot be "subdomain" of "subdomain".



Answered By - Elvis Plesky
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to get arguments from PLESK Cron jobs

 November 13, 2022     cron, php, plesk, scheduled-tasks     No comments   

Issue

I have created a Cron Job/Scheduled Task in PLESK 12 which I am passing the arguments 33 and On through using the arguments box. I am struggling to pick these up in the PHP document on the end of the cron job.

PLESK and Arguments

In the PHP document I have tried a number of things including $arg[0] and $argv[0]

$arg returned as being an undefined variable whilst $argv[0] does not error but also does not pass the arguments through successfully as the desired changed has not been made.

I have checked to ensure the PHP script is working and it works fine when the arguments are hard coded into the program but I want this to be dynamic.

<?PHP
include_once('xxx/xxx/xxx/db.php');
include('xxx/xxx/xxx/xxx/db.php');
$query = "UPDATE SQLCommand SET argument1 = '$argv[1]' WHERE argument2= $argv[0]";
$result = mysqli_query($connection,$query);

Can anyone explain why these are still not passing the arguments through.

Thanks


Solution

$argv[0] always contains the name of the script file, as it passed to the PHP binary. As per screenshot, $argv[1] is '33' and $argv[2] is 'On'. You can easily check with:

echo $argv[1];

Or you can list all arguments as an array by:

var_dump($argv);

Basically, the following task is added to crontab, when scheduled via Plesk:

/usr/bin/php5 -f '/test.php' -- '33' 'On'

If test.php contains mentioned commands, the result of its' execution will be the following:

# cat /test.php
<?php
echo "The first argument is $argv[1]\n";
echo "Here the full list of arguments:\n";
var_dump($argv);
?>
# /usr/bin/php5 -f '/test.php' -- '33' 'On'
The first argument is 33
Here the full list of arguments:
array(3) {
  [0]=>
  string(6) "/test.php"
  [1]=>
  string(2) "33"
  [2]=>
  string(2) "On"
}


Answered By - Elvis Plesky
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to obtain rights to use php command line for a plesk system user

 November 13, 2022     linux, plesk, plesk-onyx     No comments   

Issue

I´m a real begginer in linux/server/plesk. I had to rent a virtual server Ubunthu to make a test environment.

The company (host) installed automaticaly the Plesk software to help me. I would like to use a user except root via ssh to run some command lines with keys php or composer.

That works with the user root but when I connect by my plesk system user via ssh, any command was found :

bash: npm: command not found

bash: php: command not found

etc...

This user is a system user according to Plesk.

Inside the plesk panel, it´s writing this :

Here you can specify an operating system user for managing files and folders within the webspace by FTP or with File Manager. The system user is also used to access Plesk over SSH (on Linux) or RDP (on Windows) if the corresponding permissions are granted.

If I can access Plesk over SSH, that means I can run command line or just use FTP and File Manager ?

How can I get like a root user all command lines for a plesk user ?

My goal is to get a user which can only run command lines inside the plesk scope ( httpdocs folder ) and do some actions in the plesk panel, specially in the file manager.

I followed this tutorial for php but the php command was not included for my system user.


Solution

In Plesk only "System user" specified in Web Hosting Access can login to the server via SSH, but this user can not login to Plesk and use File manager.

You need to go to Plesk > Domains > example.com > Web Hosting Access and set Access to the server over SSH to /bin/bash

After that you will be able to login to the server via SSH and execute php commands:

# ssh your_sysuser@ip -bash-4.2$ pwd /var/www/vhosts/example.com -bash-4.2$ php -v PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01) -bash-4.2$ /opt/plesk/php/7.2/bin/php -v PHP 7.2.8 (cli) (built: Jul 20 2018 12:45:27) ( NTS )

Login to Plesk is only possible for Client, Reseller or an additional created user. You need to create an additional user: Plesk > Subscriptions > example.com > User > Create User Account For more information about Users check documentation



Answered By - Elvis Plesky
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to upgrade timezonedb/timelib on php7 (plesk onyx)?

 November 13, 2022     pecl, php, plesk, timezone, timezonedb     No comments   

Issue

im using PHP Version 7.0.31 on a Plesk Onyx system.

phpinfo() is showing me:

date
date/time support: enabled
timelib version: 2016.02
"Olson" Timezone Database Version   0.system
Timezone Database   internal
Default timezone    Europe/Berlin

The used timelib version "2016.02" is outdated so i need to upgrade it to the current version 2018.5 (https://pecl.php.net/package/timezonedb).

How to do that? "pecl upgrade timezonedb" didn't worked out and after hours of googling and trying i'm clueless...


Solution

Context

I've solved a similar problem in my company, but related to daylight saving time in Brazil. The time was 1 hour wrong in all our servers that uses PHP 7.0.32, while the servers that uses PHP 7.1 are working fine.

Our servers are running on AWS EC2 instances. Our timezone is America/Sao_Paulo. It's important to note that our main goal was "update timelib PHP extension", but we found that was not needed, since updating the timezone database version was enough to solve our problem.

Solution

In order to solve that outdated datetime, I've run the following commands from SSH, logged in as root user:

pecl7 install timezonedb

After that, we need to add the extension to our PHP.INI file. In my case it was loaded and located from /etc/php.ini. To check yours, just create a phpinfo.php file and check from which location your machine is loading the php.ini file:

enter image description here

Then, just run somewhat like:

nano /etc/php.ini

And then add the following line to the last line of your php.ini file:

extension=timezonedb.so

In order to check if the update has made sucessfully, restart php / php-fpm with the following command:

service php-fpm restart

Then, let's access again the PHPINFO and...

enter image description here



Answered By - Paladini
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing