Today, we are going to discuss about PHP Web Development for Linux and Ubuntu. Development and Debugging is executed on a local server while production environment is located on a remote web server. Arranging a remote web server is explained in detail in extending a PHP Application on a Remote web server with the help of PHP IDE.
PHP support is available for enormous web servers such as IIS, Xitami and more… Generally apache HTTP Server is used.
Let’s discuss the process in detail starting with Software Installation:
- Install the Apache 2 HTTP Server, PHP5 engine, MYSQL database server5.0 and PHP-5 MYSQL module. These all can be installed simultaneously as a Lamp stack or separate installation is also possible.
- Provide the required document root for Apache 2 HTTP server.
- Configure the MySQL database server
- Enable Xdebug 2.0, debugger
For installation of Apache and MySQL on Ubuntu , you must see assistance from Ubuntu community forums.
Instating the Software Packages Simultaneously
Ubuntu offers a Linux AMP (LAMP) package that includes all the required packages useful for the PHP surroundings. Software can be installed with the help of following command at the command prompt terminal window:
sudo tasksel install lamp-server
LAMP server package includes most suitable version of PHP, Apache 2, MYSQL and PHP 5 MYSQL.
Installing Software Packages Individually
In place of installing all software packages at once, some people wish to install them separately. This is beneficial if any of the components say Apache 2 HTTP Server or MYSQL server are already installed. Command line tools can be used to install these individually. Following packages can be installed individually:
- Apache 2
- PHP 5
- Mysql server
- PHP 5 MYSQL
Checking the installation
Once the set up pack is installed, a cross examination is required to know whether it is properly installed or not and also to check whether the Apache Server recognizes PHP engine or not.
To know whether Apache and PHP are installed and running properly or not, use PHP IDE and create a new PHP Project in the index.php file then add the PHP method phpinfo () and run the file. Standard PHP information form will be displayed as follows:
Solving the Issues
Some of the problems that occur very often while examining PHP installation process are as follows:
- Browser window displays a not found error for: USER/Project/index.php: Remove the ~USER string from the URL. For instance, if this error occurs for the URL
~Ubuntu/test1/index.phpthen the URL must be changed to
test1/index.php.This URL can be set for a PHP Project in PHP IDE either while creating the project or by right clicking the project node and selecting Properties > Run Configuration.
- Browser shows you the Pop up which asks you to open a file as PHP engine is remains unrecognized: This error occurs when there’s some issue with PHP-5 common package. This must be replaced with php5 and phpmyadmin.To replace it, these two commands must be used:
apt-get --purge remove php5-common
apt-get install php5 phpmyadmin
Here, we have covered just the installation process. In our next coming blog, we will be discussing about document root and Wizard activation process. To know more about PHP and its updates, stay connected with experts at Softqube Technologies, a PHP web development company in India.