Posts Under Category: PHP

If you want to add php-tidy PHP extension support on your RedHat/centOS server, here is how you can install php-tidy.
read more

In this tutorial I will explain how to install and setup LAMP on a RHEL/CentOS Linux 6.x server.
Before I start the tutorial, let’s know what is LAMP. LAMP stack is a group of open source software used to get web servers up and running. LAMP stands for Linux, Apache, MySQL, and PHP.
read more

Following command will install PHP on your CentOS server / VPS.

Login to your server as root via SSH and run following command.

yum install php php-mysql

OR

yum install php

Installation wizard will ask your confirmation. Press Y to complete installation.

Check Installation

Once PHP is installed, you can check the PHP version installed using below command

php -v

It will show something like this:

[[email protected] ~]# php -v
PHP 5.3.3 (cli) (built: Nov 22 2013 10:45:17)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Restart Apache

After installing PHP, restart Apache using below command

service httpd restart

Test PHP

After installing PHP and restarting Apache, its time to test PHP installation on the server.
Create a phpinfo.php fie in /var/www/html/ with following code:

<?php
phpinfo();
?>

Now open your http://Server-IP/phpinfo.php in any browser.
This should show PHP settings on your server. You have successfully installed PHP on your server.

You can now edit various PHP settings like memory_limit, max_execution_time, max_upload_size, post_max_size etc. in:

/etc/php.ini

Done!!

Our Recommended VPS Hosting

If phpMyAdmin is not working properly on your cPanel server, like blank phpmyadmin page. In such case, you should consider updating phpmyadmin.

Login to your server via SSH as root user. Now run following command:

/usr/local/cpanel/bin/updatephpmyadmin --force

Note:
This works on a cPanel server / VPS only.

Our Recommended Dedicated Server

If you are receiving following error message when uploading image via any script (WordPress / Drupal / Joomla / prestashop etc.)

Fatal error: Call to undefined function imagecreatefromjpeg() in /home/…/..

This means your server do not have GD Library installed.

Solution for cPanel Server

If you have root access to server, and you are on a cPanel server, you can install GD from EasyApache from:

WHM Home >> Software >> EasyApache (Apache Update)

Re-run EasyApache and select GD

Solution for non-cPanel server

If you are not on a cPanel server, here is how you can install GD library.
Login to your server as root via SSH and run following command

yum install php-gd
service httpd restart

OR

yum install gd gd-devel php-gd
service httpd restart

Done!!!

I don’t have root access of server

If you are on a shared hosting or if you do not have root access of server, please contact your hosting provider to enable / install GD library on the server.

Our Recommended Hosting

Sometimes you need to check and see what are php settings of your web hosting account. You can create a php page using the phpinfo() function to see detailed information about the PHP settings of your hosting account. Create a page named phpinfo.php and copy paste below code.

<?php
phpinfo();
?>

Now upload this phpinfo.php file in public_html folder / directory of your web hosting account.
You can now see php setting of your web hosting account by simply visiting:

yoursite.com/phpinfo.php

Relace yoursite.com by your website url in above url

Our Recommended Hosting

Generally PHP memory limit set by root host is 8-32 MB But sometime you may need more PHP memory. If you are on a shared hosting, you can increase php memory limit of your account by simply adding the following code in your .htaccess file located in public_html folder.

php_value memory_limit 128M

This will increase php memory limit of your account to 128 MB. If there is no .htaccess file in public_html folder, create a text file and rename it to .htaccess

Our Recommended Hosting