Connect Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 28 March 2013

Custom php.ini per domain in Plesk Windows server

Posted on 13:54 by Unknown

There will always be the scenarios where we need to set some special php settings for a particular domain or for a particular directory. This can be easily done in a Linux server, but with Windows it is always issues. But we can done this windows servers also and tell you what i have verified this by myself.

Prerequisites:-

*Custom php,ini file only works with php handler as “cgi” and not with “fastcgi” nor with ISAPI extension. So you need to verify this before you proceed further.

Follow the below steps to set the correct php mode.

1. Log in to your Hosting Control Panel
2. Select your domain name
3. Under “Web Site” tab, click on “Web Hosting Settings”
4. Under “PHP Support”, select your desired “PHP Mode” settings(cgi mode)
5. Hit the “Ok” button to activate.

Assumptions:-

    The default location of php.ini for PHP5 is the PleskPHP5 base directory %plesk_dir%AdditionalPleskPHP5 (Eg: c:Program FilesParallelsPleskAdditionalPleskPHP5). If you place an PHP info page, you can easily find out from where the current php settings is loaded.
    The document root of the domain “maindomain.com” is “d:Inetpubvhostsmaindomain.comhttpdocs”. Please note that this may be different in your hosting environment.
    The server I am working on is a x86 based server.
    Plesk version is 10.3.1, but it should work with others also.

Turn off the register_globals

I will explain the procedures with an example to turn off the register globals . There are two ways to configure php values for a particular domain:-

1. By placing an customized php.ini page on the corresponding directory or in domain.
2. By creating a Windows registry value for the particular php settings.
Placing an customized php.ini page on the corresponding directory
You need to place the php.ini file in “maindomain.com/httpdocs” directory or if you want to apply the only to a addon domain or a directory, then use the directory “maindomain.com/httpdocs/addondomain.com”.

Follow the below steps:-

1. Copy the PHP version 5 (php.ini-recommended or php.ini) ini file from the PHP location %plesk_dir%\AdditionalPleskPHP5 to the location “maindomain.com/httpdocs”
2. Rename the copied file to the exact name as ‘php-cgi-fcgi.ini‘. This is the most important step and won’t work otherwise.
3. You can make the changes needed to the above ini file, say set the “register_globals = Off”.
3. Create a php info page the corresponding directory and verify it is loading the correct “php.ini” (check the loaded configuration file section). Also verify whether the value you have changed is now updated under the ‘PHP info’ page.

This should do the work. If this method doesn’t work for you, here is the second method.

Creating a Windows registry value

Even though this is a simple procedure, i do not recommend anyone to edit the Windows Registry because if you screw up anything with Registry, you will also screwed up :)

When running PHP on Windows, the configuration values can be modified on a per-directory basis using the Windows registry. The configuration values are stored in the registry key HKLMSOFTWAREPHP5Per Directory Values, in the sub-keys corresponding to the path names. For example, configuration values for the directory c:inetpubwwwroot would be stored in the key HKLMSOFTWAREPHP5Per Directory Valuescinetpubwwwroot. The settings for the directory would be active for any script running from this directory or any subdirectory of it. The values under the key should have the name of the PHP configuration directive and the string value.

Simply, you can only add individual php configuration value inside of php.ini through the registry, which means that you have to set up keys to the file path ( where the client’s hosting folder located ) and then add a string value, string name will be the php.ini configuration name and value will be how you want it to be. So for setting register_globals to off for the maindomain.com, you have to setup keys to the path “HKEY_LOCAL_MACHINE > SOFTWARE > Wow6432Node > PHP > Per Directory Values > C > Inetpub > vhosts > maindomain.com > httpdocs” and then add a string value, string name will be “register_globals” and value will be 0 to put register_globals= off.
Note:

For 32 bit Windows registry path is ,  HKLMSOFTWAREPHP5Per Directory Values
For x64 based Windows registry path is,  HKEY_LOCAL_MACHINESOFTWAREWow6432NodePHP5Per Directory Values

Reference:-

http://forum.parallels.com

http://www.php.net
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to schedule a PHP script in task scheduler
    Quiet often there is a need to execute/run  php  script on some time interval at server side. And that php scripts should run automatically ...
  • HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to run CGI applications.
    If you get the error “HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to...
  • Roles and Features showing an error HRESULT: 0x800F0818 in Server Manager of windows server 2008 R2
    When you open Server Manager both Roles and Features display Error and you are unable to add any role or features. When you select the det...
  • Error - "Failed to retrieve data for this request (Microsoft.SqlServer.Management.sdk.sfc)"
    ErrError    - In Microsoft SQL Management Studio 2008, you receive the following error message when you try to expand the Databases:      ...
  • How to configure IIS 7 to redirect non-www domain to www domain?
    One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us...
  • Back up all MS SQL databases at once
    This article will discuss how to backup all MS SQL databases with one script. A separate file will be created for each database. Log into ...
  • The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241
    When you try to restore a backup of the database you get the following error: The media family on device ” is incorrectly formed. SQL Server...
  • How to check Malware injection in Code
    To check Malware injection in your script/Code you can use a Web based Google Tool called “Webmasters Tools” You can find it here Google We...
  • An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
    If you are facing the following error while accessing the website: Error Summary HTTP Error 500.24 - Internal Server Error An ASP.NET settin...
  • Stopping Unneeded Services In Windows Server 2008
    By  default Windows 2008 starts with a number of services that actually do not need to be running. Many of these services can impact perfo...

Categories

  • booting Process
  • linux
  • redhat

Blog Archive

  • ▼  2013 (68)
    • ►  July (1)
    • ►  May (2)
    • ►  April (11)
    • ▼  March (54)
      • Windows 2008 Password Complexity
      • Unable to shrink database log file ( DBCC shrinkfi...
      • The media family on device is incorrectly formed. ...
      • The 'Microsoft.Jet.OLEDB.4.0' provider is not regi...
      • SQL Warning in Functions.php on line .....The func...
      • Shrinking Truncate SQL SERVER Log File
      • Roles and Features showing an error HRESULT: 0x800...
      • Restoring a MSSQL 2005 database stuck in suspect mode
      • PowerShell script cannot be loaded because the exe...
      • MySQL Password Reset
      • Limit SQL Connections through Windows Advanced Fir...
      • Microsoft JET Database Engine error ''80004005'' -...
      • How to shrink a database log file for MSSQL Using ...
      • IIS www service fails to start with error ID 1363
      • How to retireve the password for an email account ...
      • How to resolve Windows Login Error: "An unauthoriz...
      • How to reset a DNN password at the Database
      • How to resolve error ' Error 8004020e '
      • How to reset WordPress admin password
      • How to change the Data folder for SQL Server from ...
      • Horde logout error
      • Error: mailManager->turnOnDomain() failed: mailmng...
      • Force Visitor Browser to use SSL
      • Error: Access for administrator from address 'XX.X...
      • Error - "Failed to retrieve data for this request ...
      • Enable wildcard SSL certificate for the subdomains...
      • Enable multiple RDC sessions from one user in Wind...
      • Disable Shutdown option in Windows
      • Disallowed Parent Path
      • Difference between CNAME and A records, and when t...
      • Difference between Active and Passive modes in FTP
      • annot open database "DATABASENAME" requested by th...
      • Block IP address with Windows Firewall 2008
      • An ASP.NET setting has been detected that does not...
      • Adjust Page File / Virtual Memory on Server 2008
      • Access Smartermail without port
      • 503 This mail server requires authentication when ...
      • Error : 425 Can't Open Data Connection
      • "502 Bad Gateway" - Resolution
      • Error 15023: User already exists in current database.
      • Basic Mysql Commands
      • Basic FTP Commands
      • Unable to start MySQL "Error 1067: The process ter...
      • Cannot Add Attachments Using the SmarterMail Web I...
      • How to use a MySQL test script to verify if your M...
      • Access is denied. (Exception from HRESULT: 0x80070...
      • Set a Fixed Amount of Memory (SQL Server Managemen...
      • Could not load file or assembly \'CrystalDecisions...
      • Custom php.ini per domain in Plesk Windows server
      • How to upgrade Zen Cart 1.3.9 to Zen Cart 1.5
      • How to bulk import products into Zencart 1.5
      • How to move wordpress site to a new Website
      • An error has occurred. Furthermore, Horde encounte...
      • HTTP Error 403.19 – Forbidden The configured user ...
  • ►  2012 (44)
    • ►  September (20)
    • ►  August (1)
    • ►  July (4)
    • ►  June (12)
    • ►  May (2)
    • ►  March (4)
    • ►  February (1)
  • ►  2011 (1)
    • ►  February (1)
  • ►  2009 (9)
    • ►  September (3)
    • ►  August (2)
    • ►  June (1)
    • ►  May (2)
    • ►  March (1)
Powered by Blogger.

About Me

Unknown
View my complete profile