A Phalcon installation on Windows
1 Download the appropriate DLL from Phalcon for Windows,
Here's the fit to look at two main aspects
1 Version of PHP
2 whether the thread is secure
3 Compiled version
If this information is not clear, you can write a phpinfo.php script
<?php
Phpinfo ();
?>
And then access the file directly through the browser, you can know all the above information
For example, my machine's environmental information is as follows
2 will download the DLL file, copied to the PHP extension directory to go, my directory is in the C:\Zend\ZendServer\lib\phpext
3 adding Extension=php_phalcon.dll to the php.ini file
4 restarting Apache
5 Verifying that the installation is correct
B Devtools installation (via composer installation)
1 in a directory of this machine, say d:\github\phalcon.
Add a Composer.json file
The contents are as follows
{
"Require": {
"Phalcon/devtools": "Dev-master"
}
}
2 run cmd, go to this directory such as CD D:\github\phalcon, run composer Install, will generate vendor directory, in Vendor/phalcon/devtools directory is a very important directory, his structure is as follows
3 Set the environment variable, set the step, set the path to; D:\github\phalcon\vendor\phalcon\devtools
4 Verifying that the installation is successful
Appears as shown in this diagram, stating OK
Use of C Devtools
1 under the D:\github\phalcon\ directory, create a project that can use Webtools learn
Phalcon.bat Project Learn--enable-webtools
After the completion of the establishment of the project directory for
App Catalog
Public directory
From the above can be basically judged to be an MVC framework
2 Setting up the virtual directory on Apache
The http.conf is configured as follows
<directory "D:/github" >
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
<virtualhost *:80>
DocumentRoot D:/github/phalcon/learn/public
ServerName Learn
</VirtualHost>
Add the following to the 3 Hosts file
127.0.0.1 Learn
4 after restarting the Apache service, browse Http://learn/index/index on the browser
Description OK
5 When browsing http://learn/webtools.php on the browser
This page appears to have some problems. The page looks different from the official document.
Then casually click on the page connection, such as click on the controllers connection, the following error occurred
It must have been a problem somewhere. It turns out that the browsing path on the browser has changed.
Http://learn/learn/webtools.php?_url=/controllers,
How come out of a learn? there should be only one right, so
Visit page after changing address to http://learn/webtools.php?_url=/controllers
Can run, no error, and more information on the controller
But the style of the page is still wrong. The possible cause of the wrong page style is usually caused by CSS and JS.
So open the Browser developer tool, view CSS,JS and other resource requests, found the following issues
It seems that the more learn. caused the resource not to be requested.
6 workaround.
Read the source code of webtools.php, and found that it actually finally called the
The main method inside the D:\github\phalcon\vendor\phalcon\devtools\scripts\Phalcon\Web\tools.php
The method has the following section of code, which sets the URL
$di->set (' url ', function () use ($config) {
$url = new \phalcon\mvc\url ();
$url->setbaseuri ($config->application->baseuri);
return $url;
});
So $config->application->baseuri this value is a key
And where does the $config parameter come from, find the $config, find the following code
Read Configuration
$configPaths = Array (
' Config ',
' App/config ',
' Apps/frontend/config '
);
$readed = false;
foreach ($configPaths as $configPath) {
$cpath = $configPath. '/config.ini ';
if (file_exists ($cpath)) {
$config = new \phalcon\config\adapter\ini ($cpath);
$readed = true;
Break
} else {
$cpath = $configPath. '/config.php ';
if (file_exists ($cpath)) {
$config = require $cpath;
$readed = true;
Break
}
}
}
found that it was from the Config,app/config,apps/fontend/config directory under the engineering directory of the Config.ini or config.php.
This opens the app/config/config.php file for the project learn. Found
' BaseUri ' = '/learn/', change it to ' baseUri ' and '/',
Re-refresh the page
So the problem is solved.
D Development Environment IDE settings
1 Zend Studio
After the configuration is complete, you can code hints
2 Phpstorm
The code hints are OK.
Set Devtools
This can be directly used directly in the Phpstorm
The development environment is configured to complete.
Phalcon's study of-phalcon and Devtools installation and setup