News:

SMF - Just Installed!

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Manish

#1
Hello,

Sometimes you get below errors on the CodeIgniter website.

QuoteA PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 117

Backtrace:

File: /home/user/public_html/index.php
Line: 295
Function: require_once
An uncaught Exception was encountered

Type: Exception

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.

Filename: /home/user/public_html/system/libraries/Session/drivers/Session_files_driver.php

Line Number: 119

Backtrace:

File: /home/user/public_html/index.php
Line: 295
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: fopen(f7a5103144e842f8cafeb2355869ca11dd7ecf48): failed to open stream: Permission denied

Filename: drivers/Session_files_driver.php

Line Number: 156

Backtrace:

To fix the issue follow below steps:

1. Open the config.php file in the directory Codeigniter
2. Find the following code:

Quote$config['sess_save_path'] = NULL;

3. Change to:

Quote$config['sess_save_path'] = sys_get_temp_dir();

Your website should be working fine.

That's it  :)
#2
Hi,

Sometimes you get black page on CodeIgniter website and no errors generated on the server. In such cases you can view the exact errors by enabling the display_errors from index.php file.

Open index.php file and add below code at the end of file

Quote
error_reporting(E_ALL);
ini_set('display_errors', 1);

After that access the website and it will show you exact errors.
#3
How To's / Re: Nginx Wordpress Permalinks issue
January 12, 2017, 09:22:46 AM
Hi,

If your blog is in subfolder like http://domainname/subfolder it does not work and shows "Page not found error. In such issues you will need to add separate permalink entry in configuration file on Webuzo.

Go to the path of ngnix configuration: /usr/local/apps/nginx/etc/conf.d
Open file "common" and add the below entry at the end of the file:

Quotelocation /subfoldername/ {
    try_files $uri $uri/ /subfoldername/index.php?$args;
}

Then restart the ngnix service on the server.

Add entry for each subfolder in which your blog is created.
#4
Hello All,

In Webuzo with ngnix you can enable Gzip compression and Leverage browser caching for particular domain by adding extra configuration file of domain. You will need to create configuration files like gzip.conf and leverage.conf and add below code.

Gzip compression code:

Quote# Enable Gzip
  gzip  on;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_min_length 1100;
  gzip_buffers     4 8k;
  gzip_proxied any;
  gzip_types
    # text/html is always compressed by HttpGzipModule
    text/css
    text/javascript
    text/xml
    text/plain
    text/x-component
    application/javascript
    application/json
    application/xml
    application/rss+xml
    font/truetype
    font/opentype
    application/vnd.ms-fontobject
    image/svg+xml;

  gzip_static on;

  gzip_proxied        expired no-cache no-store private auth;
  gzip_disable        "MSIE [1-6]\.";
  gzip_vary           on;

Leverage browser caching:

Quote
location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}

After that Follow below steps:

1: Login to Webuzo panel and go to Domain >> Extra Configuration

2: Select the Domain for which you want to ADD Extra Configuration File.

3: Select the Webserver for which you want to ADD Extra Configuration File.

4: Populate the input field with the location of your configuration file.

5: Click on Add record button.

6: Repeat above steps for other configuration file.

7: Then restart the nginx service on the server.

Ref: https://www.webuzo.com/docs/endusers/add-extra-configuration-file/


That's it  :)
#5
How To's / Nginx Wordpress Permalinks issue
December 02, 2016, 04:32:18 PM
Hello,

On Webuzo with nginx, wordpress permalink doesn't work by default. Due to that sub-pages or internal links don't work and they show 404 errors. In such situation we will need to add extra configuration file of domain in nginx.

For that create a custom config file on your computer and add below content in it.

Quotetry_files $uri $uri/ /index.php?q=$uri&$args;

Example: Create permalink.conf file and add provided code in it.

After that Follow below steps:

1: Login to Webuzo panel and go to Domain >> Extra Configuration

2: Select the Domain for which you want to ADD Extra Configuration File.

3: Select the Webserver for which you want to ADD Extra Configuration File.

4: Populate the input field with the location of your configuration file.

5: Click on Add record button.

6: Then restart the nginx service on the server.

Ref: https://www.webuzo.com/docs/endusers/add-extra-configuration-file/

That's it. All sub-pages and links should be working fine  :)
#6
Hi,

Sometimes on cloudlinux server(Cpanel with cloudlinux) PHP extensions doesn't showing in phpinfo even though they are complied with PHP and showing in PHP molues lists. In this case you will need to add particular PHP extension manually by using tool "selectorctl".

"selectorctl" is a new tool that replaces cl-selector (which is deprecated and should not be used anymore) and piniset. It is available starting with CageFS 5.1.3.

Follow below steps:

1) Check all available PHP verisions and native version on server using below command:
Quote[root@ ~]# selectorctl --summary --show-native-version
4.4 e -
5.1 e -
5.2 e -
5.3 e -
5.4 e -
5.5 e -
5.6 e -

2)Check extension installed for particular PHP version:
Quote[root@~l]# selectorctl --list-extensions --version=5.6
- apcu
- apm
- ares
- bcmath
- big_int

3)Suppose if you wish to add extension "fileinfo" to version PHP 5.6 run below command:
Quote[root@~]# selectorctl --enable-extensions=fileinfo --version=5.6

That's it, now check phpinfo file and fileinfo extension will show in it.
#7
Hello,

If you face issue with emails getting stucked in mail queue on cpanel server and receive error "All deliveries are handled by MailScanner" when you run mail queue manually then there is issue with the MailScanner installed on the server.

Following steps will fix the Mailscanner issue and can be run in SSH at any time without harm:


       
  • /scripts/buildeximconf
  • service exim restart
  • /usr/mscpanel/mscheck.pl
When you run above commands on the server result should be as below.


Quote[root@~]# /scripts/buildeximconf
Configuration file passes test!  New configuration file was installed.
/etc/exim.pl.local installed!
SPF is disabled in exim or unavailable, enabling SPF for SpamAssassin
Mail Scanner exim.conf updating...`/etc/exim.conf' -> `/etc/exim_outgoing.conf'
Done
Refreshing SMTP Mail protection.
SMTP Mail protection has been disabled.  All users may make outbound smtp connections.


Quote[root@~]# service exim restart
Shutting down exim:                                        [  OK  ]
Shutting down spamd:                                       [  OK  ]
Starting exim:                                             [  OK  ]
Starting exim-outgoing:                                    [  OK  ]
Starting spamd:                                            [  OK  ]


Quote[root@~]#/usr/mscpanel/mscheck.pl
Generating exim split spool directories...
Updating MailScanner.conf with sensible values...
Shutting down MailScanner daemons:
         MailScanner:
         Waiting for MailScanner to stop..
Starting MailScanner daemons: OK


Once you done this your emails should be working fine.

That's All  :)
   
#8
Hello,

In the hosting industry the traceroute   tool is a very common tool using for servers simple network status. If we install CSF in any server, the traceroute  fails. So admins will think there will be some problems. As from a security view it is good to block such packets. Even though it will be good to enable the  UDP_IN port rang  33434:33523 as open in default CSF configuration.

Open csf configuration file and search for UDP_IN

Quote# To allow incoming traceroute add 33434:33523 to this
   UDP_IN = "20,21,53,953,33434:33523"

After that restart the csf firewall on server.
Quote# csf -r

Traceroute will work fine now  :)
#9
Hello,

If you wish to set or increase Heap size in apache tomcat on cpanel server (you can see the settings that are configurable if you issue "java -X" without the quotes), then create a file named /var/cpanel/tomcat.options. Add below entries in the file:

Quote-Xmx2000M
-Xms1000M

This would change the maximum Java heap size (Xmx) and the initial Java heap size (Xms) on startup.

After this has been done, Tomcat would need to be restarted from WHM:

QuoteGo to WHM » Restart Services » Servlet Server (Tomcat)

Once you restart tomcat it will show result as below:

QuoteService Status
tomcat (jsvc.exec -user tomcat -cwd /usr/local/easy/share/easy-tomcat7 -pidfile /var/run/easy-tomcat7.pid -cp /usr/local/easy/bin/bootstrap.jar:/usr/local/easy/bin/tomcat-juli.jar:/usr/local/easy/share/java/commons-daemon.jar -Djava.endorsed.dirs=/usr/local/easy/share/easy-tomcat7/endorsed -outfile /var/log/easy-tomcat7/catalina.out -errfile /var/log/easy-tomcat7/catalina.err -verbose -Xmx2000M -Xms1000M org.apache.catalina.startup.Bootstrap start) running as 491 with PID 4437 (process table check method)

Startup Log
Adding in custom Tomcat option(s): -Xmx2000M
Adding in custom Tomcat option(s): -Xms1000M
Command '/usr/local/easy/bin/jsvc -user tomcat -cwd /usr/local/easy/share/easy-tomcat7 -pidfile /var/run/easy-tomcat7.pid -cp /usr/local/easy/bin/bootstrap.jar:/usr/local/easy/bin/tomcat-juli.jar:/usr/local/easy/share/java/commons-daemon.jar -Djava.endorsed.dirs=/usr/local/easy/share/easy-tomcat7/endorsed -outfile /var/log/easy-tomcat7/catalina.out -errfile /var/log/easy-tomcat7/catalina.err -verbose -Xmx2000M -Xms1000M org.apache.catalina.startup.Bootstrap start' returned: 0

tomcat started successfully.

That's all  :)
#10
Hello,

If you receive this message when you try to stop/start the container:
Quote[root@server ~]# vzctl start 302
Container already locked

To fix the issue delete the lock file of the container.
Quote[root@server ~]# rm /vz/lock/302.lck
rm: remove regular file `/vz/lock/302.lck'? y

After that start the container:
Quote[root@server ~]# vzctl start 302
Starting container...
Container is mounted
Container start in progress...

That's it  :)

#11
Hello,

One of our client was getting "Service Unavailable" error on website. Further checking it was generating below errors on the server.

QuoteINFO: validateJarFile(/home/username/public_html/WEB-INF/lib/selenium-server-standalone-2.52.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

There was compatibility issue of selenium-server-standalone-2.52.0.jar with the Tomcat server as it is a standalone server.

In order to fix issue don't use the standalone selenium jar, instead use the small non-standalone selenium jar and also use all the jars it depends on.

Download the full zip from HERE
After that Open the zip and copy selenium-java-2.53.0.jar in WEB-INF/lib folder and restart the Tomcat service.

That's it. Now your website should work fine  :)
 
#12
Hi All,

You can set redirection for non-www URL to www URL in tomcat using UrlRewriteFilter. Below are the steps to set redirection:

1) Download UrlRewriteFilter to WEB-INF/lib directory of your website.

2) Go to WEB-INF/web.xml and add below code (near the top above any servlet mappings):



<filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>




3) Create file urlrewrite.xml in WEB-INF and add below code:



<urlrewrite>
<rule>
              <name>Domain Name Check for example.com</name>
                <condition name="host" operator="equal">^example.com</condition>
               <from>^(.*)$</from>
               <to type="redirect">http://www.example.com$1</to>
      </rule>
</urlrewrite>




Note: Replace example.com with original domain name.

4) Restart tomcat service on the server.

That's all. Your website should now redirect from non www URL to www URL.