This is an automated email from the ASF dual-hosted git repository. vieiro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-website.git
The following commit(s) were added to refs/heads/master by this push: new 88ed888 [NETBEANS-1867] Some PHP tutorials (#315) 88ed888 is described below commit 88ed8888ee9abe2a3c60e3e4df068699c491cd77 Author: Antonio Vieiro <vie...@users.noreply.github.com> AuthorDate: Sun Feb 10 11:13:20 2019 +0100 [NETBEANS-1867] Some PHP tutorials (#315) --- .../php/configure-php-environment-mac-os.asciidoc | 41 ++++++++++-- .../php/configure-php-environment-ubuntu.asciidoc | 77 +++++++++++++--------- .../php/configure-php-environment-windows.asciidoc | 53 ++++++++++----- .../src/content/kb/docs/php/index.asciidoc | 1 + .../src/content/kb/docs/php/project-setup.asciidoc | 48 ++++++++++++-- .../src/content/kb/docs/php/quickstart.asciidoc | 24 +++++-- 6 files changed, 181 insertions(+), 63 deletions(-) diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc index fbea25c..ca5145b 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-mac-os.asciidoc @@ -28,8 +28,9 @@ :toc-title: :description: Configuring PHP, Apache, MySQL, and Xdebug for PHP development in MAC OS X - Apache NetBeans :keywords: Apache NetBeans, Tutorials, Configuring PHP, Apache, MySQL, and Xdebug for PHP development in MAC OS X +:reviewed: 2019-02-02 -This tutorial shows you how to set up PHP on the link:http://www.mamp.info/en/index.php[+MAMP+] (*M*acintosh,* A*pache, *M*ySQL, *P*HP) package, which includes the Apache web server, the MySQL database server, and the PHP engine. MAMP is intended as a PHP development environment for the Mac, which can work seamlessly with the NetBeans IDE. +This tutorial shows you how to set up PHP on the link:http://www.mamp.info/en/index.php[+MAMP+] (Macintosh, Apache, MySQL, PHP) package, which includes the Apache web server, the MySQL database server, and the PHP engine. MAMP is intended as a PHP development environment for the Mac, which can work seamlessly with the NetBeans IDE. link:http://www.Xdebug.org/[+Xdebug+] is an extension for PHP that aids in providing information valuable for debugging PHP scripts. The NetBeans debugger works on top of the Xdebug extension, providing an effective debugging tool in your development environment. @@ -47,13 +48,20 @@ NOTE: The MAMP package includes the Apache web server, PHP engine, and MySQL dat 1. Download the latest version of link:http://www.mamp.info/en/download.html[+MAMP+]. 2. Extract the downloaded file and run the `.dmg` file. When the installer displays, drag MAMP into your `/Applications` folder. + image::images/mamp-install.png[title="MAMP installer panel showing MAMP and MAMP-Pro options"] + +[start=3] 3. Navigate to `/Applications/MAMP` and double-click `MAMP.app`. The MAMP Control Panel opens. You can also install the MAMP Control dashboard widget as described in `MAMP/README.rtf`, which enables you to start and stop servers. + image::images/mamp-control-panel.png[] + +[start=4] 4. Click Preferences to open the Preferences panel, then select the Ports tab. 5. Click Set to Default Apache and MySQL ports. Apache port is reset to 80 and MySQL to 3306. + image::images/mamp-control-panel-preferences-ports.png[title="MAMP control panel with Ports tab, after ports have been changed to default values"] == Registering MAMP's MySQL Database @@ -69,16 +77,26 @@ The IDE interfaces with databases from the Services window (⌘-5). You can regi * *Server Port Number: *`3306` * *Administrator User Name: *`root` * *Administrator Password: *`root` + image::images/mysql-basic-properties.png[title="MySQL Basic Properties dialog containing MAMP's default connectivity settings"] + +[start=3] 3. Select the Admin Properties tab to display settings that enable you to start and stop the database server from the IDE. MAMP maintains shell scripts in its `bin` folder. You can find scripts for starting and stopping servers there. For the path to the Admin tool, you have a choice; you can link to `MAMP.app` so that you can use the IDE to open MAMP's control panel. To do so, enter `/Applications/MAMP/MAMP.app`. However, an alternative option would be to use the link:http://dev.mysql.c [...] * *Path/URL to admin tool: *`/Applications/MySQL Tools/MySQLWorkbench.app` _(default installation for MySQL Workbench)_ * *Path to start command: *`/Applications/MAMP/bin/startMysql.sh` * *Path to stop command: *`/Applications/MAMP/bin/stopMysql.sh` + image::images/mysql-admin-props.png[title="MySQL Admin Properties dialog containing sample administration settings"] + +[start=4] 4. If you choose to use the MySQL Workbench as your MySQL admin tool, you need to specify the socket for the connection to MAMP's database. Start MySQL Workbench and from the main page, click New Server Instance in the Server Administration column. + image::images/mysql-workbench-home.png[] + +[start=5] 5. The Create New Server Instance Profile dialog opens. Select the Local Socket/Pipe connection method and add the path to the socket file in the Parameters tab. The default location of the socket is: `/Applications/MAMP/tmp/mysql/mysql.sock`. + image::images/socket-path.png[] @@ -100,14 +118,12 @@ The IDE remembers this location for future projects. For further instructions on MAMP contains a pre-compiled ``xdebug.so`` file. To use this file, enable it in MAMP's ``php.ini`` . Xdebug does not work together with Zend Optimizer, so you also have to disable Zend Optimizer in ``php.ini`` . -*To enable Xdebug with MAMP:* - -1. Open the `php.ini` file in an editor. This file is located in: +To enable Xdebug with MAMP: -`/Applications/MAMP/conf/php5/php.ini`. +1. Open the `php.ini` file in an editor. This file is located in: `/Applications/MAMP/conf/php5/php.ini`. 2. Locate the ``[Zend]`` section and comment out every line. -[source,java] +[source,bash] ---- ;[Zend] @@ -117,9 +133,11 @@ MAMP contains a pre-compiled ``xdebug.so`` file. To use this file, enable it i ;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so ---- + +[start=3] 3. Locate the ``[xdebug]`` section and activate Xdebug (replace `xxxxxxxx` with the actual number). Add this section to the end of ``php.ini`` if it is not there. -[source,java] +[source,bash] ---- [xdebug] @@ -134,12 +152,21 @@ xdebug.remote_autostart=1 zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-xxxxxxxx/xdebug.so" ---- + For an explanation of these properties, see Related Settings in the link:http://www.Xdebug.org/docs/remote[+Xdebug Remote Debugging+] documentation. + +[start=4] 4. Note that the remote port specified for Xdebug in the previous step is: 9000. This is the default debugger port used in NetBeans. To verify this, choose NetBeans > Preferences from the main menu, then select PHP in the Options window. + image::images/php-options68.png[title="The debugging port can be set in the PHP Options window"] + If needed, you can change the debugger port here. + +[start=5] 5. Open the MAMP control panel and select the PHP tab. Deselect Zend Optimizer. + image::images/mamp-control-panel-preferences-php.png[title="MAMP Control Panel with PHP tab, after Zend Optimizer has been unselected"] + 6. Start (or restart) the MAMP Apache server. == Debugging PHP Projects diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc index 2c8c04c..dc893f2 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-ubuntu.asciidoc @@ -28,12 +28,14 @@ :toc-title: :description: Configuring the PHP Development Environment in Linux Ubuntu - Apache NetBeans :keywords: Apache NetBeans, Tutorials, Configuring the PHP Development Environment in Linux Ubuntu +:reviewed: 2019-02-02 -== Configuring the PHP Development Environment in Linux Ubuntu This tutorial shows how to configure the PHP development environment in the Ubuntu operating system (7.10 and later). This involves installing and configuring the PHP engine, a MySQL database, an Apache web server, and the XDebug debugger. -*To follow this tutorial, you need the following software and resources.* +== Requirements + +To follow this tutorial, you need the following software and resources. |=== |Software or Resource |Version Required @@ -68,7 +70,7 @@ See the link:https://help.ubuntu.com/community/ApacheMySQLPHP[+Ubuntu community+ Ubuntu provides a Linux AMP (LAMP) package that contains all the necessary packages for your PHP environment. You can install the software by executing the following command at the command prompt in the Terminal window: -[source,java] +[source,bash] ---- sudo tasksel install lamp-server @@ -89,13 +91,12 @@ The individual packages to install are the following: * php5-mysql -=== - ==== Checking the Installation After you set up your PHP web stack, check that it is installed correctly and that your Apache server recognizes your PHP engine. To check that Apache and PHP are installed and running, open NetBeans IDE and link:./project-setup.html[+create a PHP project+]. In the ``index.php`` file, enter the PHP method ``phpinfo()`` . Run the file. The standard PHP information page should display. + image::images/ubuntu-phpinfo.png[] [[troubleshooting]] @@ -103,10 +104,10 @@ image::images/ubuntu-phpinfo.png[] The following are some frequently encountered problems when checking the installation of your PHP stack in Ubuntu: -* *The browser window displays a Not Found error for ``~USER/PROJECT/index.php`` *. Remove the ``~USER`` string from the URL. For example, if this error appears for the URL ``~ubuntu/test1/index.php`` , change the URL to ``test1/index.php`` . Note that you can set the URL for a PHP project in NetBeans IDE either when you create the project, or by right-clicking the project node and going to Properties > Run Configuration. -* *The browser shows you a popup asking you to open the file, as if the PHP engine is not recognized.* There's a problem with your ``php5-common`` package. Replace it with ``php5`` and ``phpmyadmin`` . To replace ``php5-common`` , run the following two commands: +* The browser window displays a Not Found error for ``~USER/PROJECT/index.php``. Remove the ``~USER`` string from the URL. For example, if this error appears for the URL ``~ubuntu/test1/index.php`` , change the URL to ``test1/index.php`` . Note that you can set the URL for a PHP project in NetBeans IDE either when you create the project, or by right-clicking the project node and going to Properties > Run Configuration. +* The browser shows you a popup asking you to open the file, as if the PHP engine is not recognized. There's a problem with your ``php5-common`` package. Replace it with ``php5`` and ``phpmyadmin`` . To replace ``php5-common`` , run the following two commands: -[source,java] +[source,bash] ---- apt-get --purge remove php5-commonapt-get install php5 phpmyadmin @@ -117,7 +118,7 @@ apt-get --purge remove php5-commonapt-get install php5 phpmyadmin The Document Root is the directory where the Apache HTTP server takes files for displaying in the browser. The Document Root is specified in the file that defines your virtual host. The default virtual host configuration file is -[source,java] +[source,bash] ---- /etc/apache2/sites-available/default @@ -126,7 +127,7 @@ The Document Root is the directory where the Apache HTTP server takes files for with the document root -[source,java] +[source,bash] ---- /var/www/ @@ -134,10 +135,6 @@ with the document root We recommend that you create your own virtual host and enable it instead of editing the default one. -* <<createDocumentRootLocation,Create the Document Root Location>> -* <<createNewVirtualHost,Specify the new document root in a new virtual host>> -* <<activateNewVirtualHost,Activating the new virtual host>> - ==== Creating the Document Root Location 1. Choose Places > Home Folder. @@ -146,60 +143,69 @@ We recommend that you create your own virtual host and enable it instead of edit ==== Creating a New Virtual Host -1. To -launch the Terminal, choose Applications>Accessories>Terminal. The Terminal window opens. +1. To launch the Terminal, choose Applications > Accessories > Terminal. The Terminal window opens. 2. To copy the configuration file of the default virtual host to a new file ( ``mysite`` ), type the following command at the command prompt: -[source,java] +[source,bash] ---- sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite ---- -3. Run the `` -gedit`` application and edit the new configuration file ( ``mysite`` ) in it: -[source,java] +[start=3] +3. Run the ``gedit`` application and edit the new configuration file ( ``mysite`` ) in it: + +[source,bash] ---- gksudo gedit /etc/apache2/sites-available/mysite ---- If asked, enter the password that you specified for the root user during the installation of your operating system. + +[start=4] 4. Change the Document Root to point to the new location: -[source,java] +[source,bash] ---- /home/<user>/public_html/ ---- + +[start=5] 5. Change the Directory directive, replace -[source,java] +[source,ini] ---- <Directory /var/www/> ---- with -[source,java] +[source,ini] ---- <Directory /home/user/public_html/> ---- + image::images/ubuntu-change-directory-root.png[] + +[start=6] 6. Save the file ``mysite`` ==== Activating the New Virtual Host 1. To deactivate the default host and activate the new host, <<launchTerminal,launch the Terminal >>and run the following two utilities in the Terminal window: -[source,java] +[source,bash] ---- sudo a2dissite default && sudo a2ensite mysite ---- + +[start=2] 2. Restart the Apache HTTP server: -[source,java] +[source,bash] ---- sudo /etc/init.d/apache2 reload @@ -211,22 +217,24 @@ During the installation of the MySQL database server, a root user is created. A 1. To connect to the MySQL server,<<launchTerminal, launch the Terminal>> and in the Terminal window enter the following command: -[source,java] +[source,bash] ---- mysql -u root -p ---- The MySQL command prompt appears. + +[start=2] 2. At the command prompt enter the following command and press Enter: -[source,java] +[source,sql] ---- SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<yourpassword>'); ---- If the command is executed successfully, the following message is displayed: -[source,java] +[source,bash] ---- Query OK, 0 rows affected (0.00 sec) @@ -251,6 +259,8 @@ To build XDebug from sources you need two additional modules: PHP5 Development a * php5-dev * php-pear For each item, from the context menu choose Mark for installation. + +[start=4] 4. The Mark additional required changes dialog box opens with a list of dependent packages that should be also installed to enable the work of the software. Click Mark. 5. The system returns to the Synaptic Package Manager panel where the selected packages are marked for installation. 6. Choose Apply on the toolbar. The Apply the following changes summary panel opens with a list of packages selected for installation. Click Apply. @@ -258,9 +268,10 @@ For each item, from the context menu choose Mark for installation. NOTE: You can also install the modules by running the following command in the Terminal window: ``aptitude install php5-dev php-pear`` +[start=8] 8. You can now download and install XDebug. Enter the following command in the Terminal window: -[source,java] +[source,bash] ---- sudo pecl install xdebug @@ -272,16 +283,18 @@ To enable XDebug, you need to edit the php.ini file in the <<gedit, ``gedit`` >> 1. To start the ``gedit`` text processor, launch the <<launchTerminal,Terminal>> and type the following command at the command prompt: -[source,java] +[source,bash] ---- gksudo gedit ---- If asked, enter the password specified for the root user during the installation of your operating system. + +[start=2] 2. Open the file ``/etc/php5/apache2/php.ini`` . 3. Add the following lines to the file: -[source,java] +[source,ini] ---- zend_extension=/usr/lib/php5/<DATE+lfs>/xdebug.so @@ -290,3 +303,5 @@ xdebug.remote_enable=on ---- Check link:http://2bits.com/articles/setting-up-xdebug-dbgp-for-php-on-debian-ubuntu.html[+ here+] for more details on configuring XDebug. + + diff --git a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc index 6ea6f76..3fe3ff7 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/configure-php-environment-windows.asciidoc @@ -28,12 +28,13 @@ :toc-title: :description: Configuring PHP Development Environment in Windows - Apache NetBeans :keywords: Apache NetBeans, Tutorials, Configuring PHP Development Environment in Windows +:reviewed: 2019-02-02 -== Configuring PHP Development Environment in Windows +This tutorial shows you two ways of configuring your PHP development environment on the Windows operating system. The first and most convenient way is to install and configure an AMP (Apache, MySQL, PHP) package. This tutorial shows you how to install the XAMPP package. The second way is to install and configure each component separately. -This tutorial shows you two ways of configuring your PHP development environment on the Windows operating system. The first and most convenient way is to install and configure an AMP (*A*pache, *M*ySQL, *P*HP) package. This tutorial shows you how to install the XAMPP package. The second way is to install and configure each component separately. +== Requirements -*To follow this tutorial, you need the following software and resources.* +To follow this tutorial, you need the following software and resources. |=== |Software or Resource |Version Required @@ -61,6 +62,7 @@ To create, run, and debug your PHP projects you need the following software: * The PHP engine. The supported version is PHP5. Downloads are available link:http://www.php.net/downloads.php[+here+]. * The PHP debugger. The NetBeans IDE for PHP allows you to use link:http://www.xdebug.org[+XDebug+], but using a debugger is optional. The recommended version is XDebug 2.0 or higher as it is compatible with PHP5. * A database server. You can use various database servers while one of the most popular ones is the MySQL server. Downloads are available link:http://dev.mysql.com/downloads/mysql/5.1.html[+here+]. + NOTE: The recommended version of the product is MySQL Server 5.0. The provided documents describe the work with this version. After the installation, you need to set up the environment that all the software components work properly with each other. @@ -71,35 +73,42 @@ You can use a <<XAMPP, Package>>, that contains the required software, or <<inst To have all the configuration settings for the PHP engine, the Apache HTTP Server, and the MySQL database server specified automatically, use an AMP package. This tutorial gives instructions only for the link:http://www.apachefriends.org/en/xampp-windows.html[+XAMPP-Windows+] package. For help with the WAMP package, please see the link:http://wiki.netbeans.org/HowToConfigureXDebug[+NetBeans XDebug Wiki+]. +[[XAMPP]] ==== Installing and Configuring the XAMPP Package The section describes how to download, install, and configure the XAMPP package. -*Warning:* Do NOT use XAMPP 1.7.0. There are significant problems with XDebug in this version. Use version 1.7.1 or later, where these problems are fixed. +WARNING: Do NOT use XAMPP 1.7.0. There are significant problems with XDebug in this version. Use version 1.7.1 or later, where these problems are fixed. -NOTE: *Starting with XAMPP 1.7.2, XAMPP comes with PHP 5.3, not PHP 5.2.x. NetBeans IDE for PHP version 6.7.x does not support the new PHP 5.3 functions. NetBeans IDE for PHP 6.8, currently available as a development build, fully supports PHP 5.3. Also note that Xdebug installation differs between PHP 5.2.x and PHP 5.3. +NOTE: Starting with XAMPP 1.7.2, XAMPP comes with PHP 5.3, not PHP 5.2.x. NetBeans IDE for PHP version 6.7.x does not support the new PHP 5.3 functions. NetBeans IDE for PHP 6.8, currently available as a development build, fully supports PHP 5.3. Also note that Xdebug installation differs between PHP 5.2.x and PHP 5.3. 1. Download the link:http://www.apachefriends.org/en/xampp-windows.html[+XAMPP+] installer package. (XAMPP Lite does not include XDebug.) 2. When the download is completed, run the `` .exe `` file. On Microsoft Vista, the User Access Control feature blocks the PHP installer from updating the Apache httpd configuration. Disable UAC while you are installing XAMPP. See link:http://support.microsoft.com/kb/922708[+Microsoft support+] for more information. +[start=3] 3. You are given the option to install the Apache server and the MySQL database server as services. If you install the Apache Server and MySQL as services, you will not have to start them manually through the XAMP Control Panel. Note that you have the option to install or uninstall these services in the <<xamppConstolPanel,XAMPP Control Panel>>. 4. If you are using the self-extracting archive, after the archive is extracted, run the file ``setup-xampp.bat`` to configure the components of the package. (The XAMPP installer runs this file automatically.) 5. After configuration, open the XAMP Control Panel. (You can open it manually by running the file ``XAMPP_HOME/xampp-control.exe`` or from the Xampp Control Panel icon that is automatically placed on your desktop.) When you open the XAMPP Control Panel, note that the modules that are installed as services are already running. -*Warning: *On Windows Vista sometimes ``xampp-control.exe`` will not run. You can run ``xampp-start.exe`` instead. +WARNING: On Windows Vista sometimes ``xampp-control.exe`` will not run. You can run ``xampp-start.exe`` instead. -*Warning: *The ``winmysqladmin.exe file`` , which is launched by the Admin button for MySQL, does not work. A cascade of error messages appears, which can only be stopped by manually terminating the ``winmysqladmin`` process. You cannot launch ``winmysqladmin.exe`` from the command line, either. See link:http://bugs.xampp.org/view.php?id=71[+http://bugs.xampp.org/view.php?id=71+]. +WARNING: The ``winmysqladmin.exe file`` , which is launched by the Admin button for MySQL, does not work. A cascade of error messages appears, which can only be stopped by manually terminating the ``winmysqladmin`` process. You cannot launch ``winmysqladmin.exe`` from the command line, either. See link:http://bugs.xampp.org/view.php?id=71[+http://bugs.xampp.org/view.php?id=71+]. image::images/xampp-control-panel.png[] + +[start=6] 6. The Svc checkboxes indicate that a module is installed as a Windows service and will start automatically on system startup. You can install or uninstall Windows services by selecting or unselecting the Svc checkbox. Uninstalling a Windows service does not uninstall the module, but it does require you to start the module manually. The XAMPP control panel includes buttons for stopping and starting modules and opening their administration consoles. ==== Checking XAMPP Installation 1. Run your browser and enter the following URL: ``http://localhost`` . The XAMPP welcome page opens: + image::images/xampp-welcome-page.png[] + 2. To ensure that the Apache and MySQL servers have been installed as system services, restart your operating system, run the browser, and enter the ``http://localhost`` URL again. The XAMPP welcome page opens. Note that the XAMPP welcome page includes a menu in the left margin through which you can check the status of XAMPP components and run ``phpinfo()`` , among other useful features. ``phpinfo()`` returns a screen with configuration information about your XAMPP components. + image::images/xampp-phpinfo.png[] ==== Installing and Enabling the XDebug Debugger @@ -117,7 +126,7 @@ You must download XDebug, place the .dll file in your php extensions directory, 2. Locate and open the active ``php.ini`` file for your XAMPP. This is located by default in the `` XAMPP_HOME/apache/bin`` directory. Confirm which ``php.ini`` file is active by running ``phpinfo()`` and searching for Loaded Configuration File. 3. Because Zend optimizer blocks XDebug, you need to disable Zend optimizer. In the active ``php.ini `` file, locate the following lines and delete them or mark as comments (To be safe, search for and comment out all properties related to Zend): -[source,java] +[source,ini] ---- [Zend] @@ -128,10 +137,12 @@ You must download XDebug, place the .dll file in your php extensions directory, ;zend_optimizer.license_path = ---- + +[start=4] 4. To attach XDebug to the PHP engine, uncomment the following lines in the ``php.ini`` files (directly beneath the [Zend] section, add them if not there). Some additional notes have been added. -[source,java] +[source,ini] ---- [XDebug]; Only Zend OR (!) XDebug @@ -144,6 +155,7 @@ Set the ``xdebug.remote_enable`` property to 1, not "true" or any other value. NOTE: Make sure the paths you specify match the location of the corresponding files as determined during your installation. +[start=5] 5. Save ``php.ini`` . 6. Run the <<xamppConstolPanel,XAMPP Control Panel Application>> and restart the Apache server. See link:http://wiki.netbeans.org/HowToConfigureXDebug[+our wiki+] and the link:http://www.xdebug.org/docs/install[+XDebug documentation+] for more information on how to configure XDebug. @@ -173,15 +185,17 @@ See link:http://wiki.netbeans.org/HowToConfigureXDebug[+our wiki+] and the link: On Microsoft Vista, do not install the Apache Server to the default location, which is in Program Files. All files in Program Files are write-protected. +[start=3] 3. When the installation is completed, restart the Apache server. 4. To check that the installation is successful, run the browser and enter the following URL: -[source,java] +[source,ini] ---- http://localhost/ ---- The Apache welcome test page opens: + image::images/install-apache-it-works-port80.png[] ===== Troubleshooting @@ -201,8 +215,9 @@ Find more information on installing and configuring the server link:http://httpd 1. Download the link:http://windows.php.net/download/[+Windows binary installer+] for the PHP5 version of your choice. -*Important: *If there is no installer available for the version of PHP you want to install, you have to install it manually from the .zip file. See link:http://php.net/manual/en/install.windows.manual.php[+Manual Instruction Steps+] in the php.net documentation. +NOTE: If there is no installer available for the version of PHP you want to install, you have to install it manually from the .zip file. See link:http://php.net/manual/en/install.windows.manual.php[+Manual Instruction Steps+] in the php.net documentation. +[start=2] 2. When the download is complete, run the ``.msi`` installation file. The installation wizard starts. 3. On the Apache Configuration Directory panel, specify the directory where the ``httpd.conf`` file is located, the default setting is ``C:\Program Files\Apache Software Foundation\Apache<version>\conf\`` . The PHP processing will be enabled automatically. 4. If you want to use the MySQL database server, choose the Complete installation option or select the MySQL and MySQLi items in the Extensions list. @@ -217,8 +232,10 @@ Find more information on installing and configuring the server link:http://httpd echo "PHP has been installed successfully!"; ?> ---- + * Save the file in the htdocs folder as `test.php`. The default path is ``C:\Program Files\Apache Software Foundation\Apache<version>\htdocs\test.php`` * Run the browser and enter the following URL: ``http://localhost:<port>/test.php`` . The following page opens: + image::images/install-php-test.png[] ===== Troubleshooting @@ -228,12 +245,13 @@ If the page does not open: 1. Restart the Apache server. 2. Check that the Apache server configuration file httpd.conf contains the following lines: -[source,java] +[source,ini] ---- AddType Application/x-httpd-php .php LoadModule php5_module "c:/php/sapi/php5apache2_2.dll" ---- +[start=3] 3. If the lines are missing, add them, save ``httpd.conf`` , and restart Apache. 4. Refresh the http://localhost:<port>/test.php page. @@ -255,7 +273,7 @@ Find detailed information on link:../ide/install-and-configure-mysql-server.html For a *thread-safe* PHP 5.2 engine: -[source,java] +[source,ini] ---- zend_extension_ts="<path to the php folder>/php_xdebug-<version-number>.dll" @@ -265,7 +283,7 @@ xdebug.remote_enable=1 For a *non-thread-safe* PHP 5.2 engine: -[source,java] +[source,ini] ---- zend_extension_nts="<path to the php folder>/php_xdebug-<version-number>.dll" @@ -275,7 +293,7 @@ xdebug.remote_enable=1 For *any* PHP 5.3 engine: -[source,java] +[source,ini] ---- zend_extension="<path to the php folder>/php_xdebug-<version-number>.dll" @@ -285,7 +303,7 @@ xdebug.remote_enable=1 Some users also find that they need to include the following lines, although other users do not: -[source,java] +[source,ini] ---- xdebug.remote_host=127.0.0.1xdebug.remote_port=9000 @@ -296,7 +314,9 @@ Click link:http://www.xdebug.org/docs/install[+here+] for more information on ho NOTE: Make sure the paths you specify match the names and locations of the corresponding files as determined during your installation. +[start=3] 3. To be sure that previously installed PHP engine supports using the MySQL database server: + 1. Click Start > Control Panel. 2. On the Control Panel, choose Add or Remove Programs. 3. On the Add or Remove Programs panel, select the PHP <version number> area and click Change. The PHP Setup Wizard starts. Click Next. @@ -306,3 +326,4 @@ NOTE: Make sure the paths you specify match the names and locations of the corre 7. On the Choose Items to Install panel, expand the Extensions node and choose the MySQL and MySQLi items. Click Next. 8. On the Ready to change PHP <version number> panel, click Change. 9. On the Completed the PHP <version number> Setup Wizard panel, click Finish. + diff --git a/netbeans.apache.org/src/content/kb/docs/php/index.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/index.asciidoc index 7426116..9060a11 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/index.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/index.asciidoc @@ -33,6 +33,7 @@ Below are resources for using NetBeans IDE to develop PHP applications and HTML5 - link:../webclient/html5-gettingstarted.html[Getting Started with HTML5 Applications] - link:quickstart.html[Getting Started with PHP Applications] +[[configuration]] == Configuration - link:configure-php-environment-mac-os.html[Configuring PHP, Apache, MySQL, and Xdebug for PHP development in MAC OS X] diff --git a/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc index 40c480f..6b5a2ae 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/project-setup.asciidoc @@ -28,10 +28,13 @@ :toc-title: :description: Setting Up a PHP Project - Apache NetBeans :keywords: Apache NetBeans, Tutorials, Setting Up a PHP Project +:reviewed: 2019-02-02 This tutorial shows you how to set up a PHP project in NetBeans IDE. -*To follow this tutorial, you need the following software and resources.* +== Requirements + +To follow this tutorial, you need the following software and resources. |=== |Software or Resource |Version Required @@ -76,9 +79,13 @@ The document root is the folder where the local web server looks for files to op A copy of the source files must be kept in a subfolder of the document root. However, you can have your Sources Folder in a different location than the document root and copy source files from this location to the document root. See <<copy-sources,Specifying the Run Configuration>>. +[start=4] 4. From the Default Encoding dropdown list, choose the default encoding for your project. 5. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory. + image::images/new-php-project-m1.png[] + +[start=6] 6. Click Next. The Run Configuration panel opens. @@ -87,10 +94,16 @@ image::images/new-php-project-m1.png[] 1. In the Projects area, choose PHP Application with Existing Sources and click Next. The New PHP Project > Name and Location panel opens. 2. In the Project Name text field, enter the name of the project. 3. In the Sources Folder field, specify the folder from where you want to import the source files. + NOTE: If you are going to run the <<localServer,project on a local web server>>, do not forget to specify <<copyFilesFromSourcesFolder,copying the source files>> to it. + +[start=4] 4. From the Default Encoding dropdown list, choose the default encoding for your project. 5. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory. + image::images/new-php-project-with-ssources.png[] + +[start=6] 6. Click Next. The Run Configuration panel opens. @@ -102,6 +115,7 @@ image::images/new-php-project-with-ssources.png[] The document root is the folder where the local web server looks for files to open in the browser. The document root is specified in the web server link:../../trails/php.html#configuration[+configuration file+]. After installation, the New Project wizard locates the document root and by default specifies the following path: ``<Document Root>\<New PHP Project>`` . Note that it is useful to be able to test the project on a local server. +[start=4] 4. If you want to store NetBeans metadata in a different location than your source files, select "Put NetBeans metadata into a separate directory." For example, you might want to store your sources in your document root but the NetBeans metadata in your NetBeansProjects directory. 5. Click Next. The Remote Connection panel opens. The tutorial link:remote-hosting-and-ftp-account.html[+Deploying a PHP Application to a Remote Web Server+] describes how to set up remote connections. @@ -128,11 +142,14 @@ The process for creating additional run configurations, or editing the default r A local web site configuration involves a copy of your PHP source folders in the Web folder of the Apache web server installed on your machine. It is common practice for a project to have both a local and a remote web site configuration. Note that the procedure for setting up the local web site run configuration differs slightly depending on whether you are creating a project from existing sources or without existing sources. -*To set up a local web site configuration:* +To set up a local web site configuration: 1. From the Run As dropdown list, choose Local Web Site. 2. In the Project URL field, check the automatically generated URL address. Make sure that the Apache HTTP server listens to the default port 80. If not, specify the port number explicitly, in the format ``localhost:<port number>`` . + image::images/run-configuration-local-server-project-with-existing-sources.png[] + +[start=3] 3. If you are creating the project from existing sources, you can choose which source file to use as the index file. 4. To store the project's source files in a different directory than the NetBeans IDE project, select "Copy files from Sources Folder to another location". _If you are creating a project from existing sources, this is a required step, unless the existing sources were already in the web folder of your Apache server._ The field by default specifies the following path: `` <Document Root>\<New PHP Project>`` . Use the Browse button to specify a different path, if necessary. @@ -149,15 +166,23 @@ See the tutorial link:remote-hosting-and-ftp-account.html[+Deploying a PHP Appli === Script 1. From the Run As dropdown list, choose Script. + image::images/project-properties-script.png[] + +[start=2] 2. To specify the location of the PHP engine, click the Configure button next to the Use Default PHP Interpreter box. The PHP Options dialog opens on the General tab. + image::images/run-config-script-options-m1.png[] + +[start=3] 3. In the PHP 5 Interpreter field, specify the path to the ``php.exe`` file. Use the Browse or Search... button, if necessary. 4. To specify how the script execution results will be shown, select the relevant checkbox in the Open Result In area. The following options are available: * Output Window. The results of executing a script will appear in the output window in the bottom of the NetBeans IDE window. * Web Browser. The default browser window will open with the results of executing a script in the form of an HTML file. * Editor. The results of executing a script will open as an HTML file in the IDE editor window. + +[start=5] 5. Click OK. The Options dialog box closes and the system returns to the Run Configuration panel. 6. Add any arguments, such as ``debug=true`` , and any link:http://www.php.net/manual/en/features.commandline.options.php[+PHP command-line options+]. @@ -175,7 +200,10 @@ On the Sources panel: 1. The Web Root field shows the root folder of your application site. By default, the field shows the Sources folder. To change the web root, click Browse and select another folder. 2. Select the <<location,Copy files from Sources Folder>> to another location, if necessary, and specify the path to the storage folder. 3. Change the encoding, if necessary + image::images/pprop-sources.png[] + +[start=4] 4. To complete the project customization, click OK. @@ -189,7 +217,10 @@ On the Run Configuration panel, modify the default run configuration and/or defi 3. In the Configuration Name field, enter the name of the new run configuration and click OK. You return to the Run Configuration panel. 4. Define the run configuration settings in the same way as you defined the <<runConfiguration,default run configuration>> during the project creation and click OK. The new configuration is added to the Configuration dropdown list. 5. To remove a configuration, select it from the Configuration dropdown list and click Delete. + image::images/pprop-runconfig.png[] + +[start=6] 6. To complete the project customization, click OK. @@ -202,7 +233,10 @@ On the Include Path panel, specify the location of the files that you need to us 2. Select the relevant folders and click Open. You return to the PHP Include Path panel. The new folder is added to the list. 3. To navigate through the list, use the buttons Move Up and Move Down. 4. To remove a folder from the list of included folder, select the folder and click Remove. + image::images/pprop-include-path.png[] + +[start=5] 5. To complete the project customization, click OK. @@ -210,17 +244,20 @@ image::images/pprop-include-path.png[] On the Formatting panel, define the formatting style you want to apply to your source files in the editor. You may define either global or project-specific formatting. -*To define global IDE formatting:* +==== To define global IDE formatting: 1. Choose "Use global options". 2. Click Edit Global Options. The IDE Options dialog opens, on the Editor > Formatting tab. + image::images/global-formatting.png[] + +[start=3] 3. From the Language dropdown list, select the language to which the settings should be applied. 4. From the Categories dropdown list, select the format items to which the setting will be applied. 5. Set your desired formatting and click OK. 6. Click the Help button for detailed information. -*To define project-specific formatting:* +==== To define project-specific formatting: 1. Choose "Use project-specific options". The hidden area displays. image::images/pprop-formatting.png[] 2. From the Language dropdown list, select All Languages or PHP. In this case, All Languages means PHP and all other languages you have in your PHP project. @@ -233,9 +270,10 @@ image::images/global-formatting.png[] Built-in JavaScript libraries were removed in NetBeans IDE 6.7 because they were very large and slowed performance and it is easy to add libraries manually. Manually adding JavaScript libraries to your project enables Code Completion and all other JavaScript-related functionality in the IDE for your project. -*To add JavaScript Libraries to your project:* +==== To add JavaScript Libraries to your project: 1. Download the JavaScript libraries you need, or locate them if you already have them. 2. Copy the JavaScript libraries to your PHP project folder, using the IDE or a file explorer. If your project properties are set so that project sources are copied to another location (see <<sources,Sources>>), the JavaScript libraries are also copied to this location. If your project is deployed on a remote server, the JavaScript libraries are uploaded to that server the next time your project sources are uploaded to the server. + diff --git a/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc b/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc index 07c4e4d..9dab76f 100644 --- a/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/php/quickstart.asciidoc @@ -28,10 +28,13 @@ :toc-title: :description: NetBeans IDE PHP Quick Start Tutorial - Apache NetBeans :keywords: Apache NetBeans, Tutorials, NetBeans IDE PHP Quick Start Tutorial +:reviewed: 2019-02-02 This document provides general guidelines for preparing the environment for PHP development, setting up a PHP project, and developing and running your first PHP application in the NetBeans IDE for PHP. -*To follow this tutorial, you need the following software and resources.* +== Requirements + +To follow this tutorial, you need the following software and resources. |=== |Software or Resource |Version Required @@ -44,7 +47,7 @@ This document provides general guidelines for preparing the environment for PHP |A PHP debugger |link:http://www.xdebug.org[+XDebug 2.0 or later+] |=== -You can install the PHP engine, web server and database separately or use AMP (*A*pache, *M*ySQL, *P*HP) packages. +You can install the PHP engine, web server and database separately or use AMP (Apache, MySQL, PHP) packages. == Installation and Configuration @@ -63,11 +66,17 @@ To start PHP development in the NetBeans IDE for PHP, you first need to create a 1. Start the IDE, switch to the Projects window, and choose File > New Project. The Choose Project panel opens. 2. In the Categories list, choose PHP. 3. In the Projects area, choose PHP Application and click Next. The New PHP Project > Name and Location panel opens. + image::images/new-project-name-location.png[title="Name and Location panel of New PHP Project wizard, with Source Folder location as XAmpp document root."] + +[start=4] 4. In the Project Name text field, enter ``NewPHPProject`` . -5. In the Sources Folder field, browse for your PHP document root and create a subfolder there called ``NewPHPProject`` . The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server link:../../trails/php.html#configuration[+configuration file+]. For example, on Xampp, the document root is XAMPP_HOME/htdocs. +5. In the Sources Folder field, browse for your PHP document root and create a subfolder there called ``NewPHPProject`` . The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server link:index.html#configuration[+configuration file+]. For example, on Xampp, the document root is XAMPP_HOME/htdocs. 6. Leave all other fields with their default values. Click Next. The Run Configuration window opens. + image::images/new-project-run-config.png[] + +[start=7] 7. In the Run As drop-down list, select Local Web Site. The project will run on your local Apache server. Your other options are to run the project remotely via FTP and to run it from the command line. 8. Leave the Project URL at default. 9. Click Finish. The IDE creates the project. @@ -78,16 +87,23 @@ Learn more about link:project-setup.html[+Setting up a PHP project in NetBeans+] 1. Start the IDE, choose File > Open Project. The Open Project dialog box opens. 2. Select ``NewPHPProject`` and click Open Project. The NewPHPProject tree appears in the Projects window and the project's ``index.php`` file opens in the editor and in the Navigator window. + image::images/getting-started-open-new-project.png[] + +[start=3] 3. Enter the following code inside the ``<?php ?>`` block: -[source,java] +[source,php] ---- echo "Hello, world! This is my first PHP project!"; ---- + +[start=4] 4. To run the project, position the cursor on the NewPHPProject node and choose Run from the context menu. The figure below shows what you should see in the browser window: + image::images/getting-started-browser-hello-world.png[] + Congratulations! Your program works! == Using Database Servers with NetBeans IDE for PHP --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists