• 28Nov

    People compare PHP with other software development languages. According to many articles, there is one major difference: PHP does not support asynchronous processing, threading, etc. Working as an Apache module, that’s correct. But if you’re running your script on CLI or CGI module you have an option: Fork.

    Fork is a child processing method. As different from your regular PHP scripts, pcntl_fork() is not linear. Because of this, for some developers, it’s a little bit hard to learn how fork works.

    All processes you run have a unique process id. We call that id PID. All processes also have another ID which is reference to the parent process. We call that id PPID. pcntl_fork() is just copying current process and pretend as it’s a child process. New child process gets a unique PID and our process’s PID becomes PPID for new child process.

    When you call pcntl_fork() it always returns INT value. For child processes, it returns 0. For parent, it returns PID if everything’s fine. Otherwise, it returns -1. When you get -1 that means something is just wrong.

  • 20Nov

    There are two different stable package for Symfony

    If you want to install 1.0 please follow these instructions:

    • $ pear channel-discover pear.symfony-project.com
    • $ pear install symfony/symfony-1.0.18

    For new version, these instructions will help:

    • $ pear channel-discover pear.symfony-project.com
    • $ pear install symfony/symfony-1.1.5

    Please, be sure you already installed php-pear library.

    Updated: Symfony 1.2.0 is stable now!

    • $ pear channel-discover pear.symfony-project.com
    • $ pear install symfony/symfony-1.2.0
  • 03Oct

    BARAKA is a Web Application Framework for PHP Beginners. Everything is -action & view separated in BARAKA. So, It’s good to learn how to work with frameworks.

    When you extract BARAKA in your web directory you’ll have a test project directly. You can modify that project for your own purposes. Or, you can create your own projects and modules with them.

    First, open your terminal and change the directory to your BARAKA folder and run these commands one by one:

    • php baraka.php create-project project_name
    • php baraka.php create-module project_name module_name
    • php baraka.php clear-cache

    You can use cp instead of create-project, cm instead of create-module and cc instead of clear-cache. Don’t forget to install php-cli library before running these commands. Otherwise, you can’t run terminal commands.

  • 19Sep

    <VirtualHost localhost:80>
    ServerAdmin baraka@localhost
    ServerName test.baraka
    DocumentRoot /var/www/baraka/run
    DirectoryIndex index.php

    <Directory /var/www/baraka/run>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    Update: Please check your Baraka path before load that configuration.

  • 19Sep

    In BARAKA Framework, you can manage your sessions easily. There are some methods to do that but the most important method is based on a configuration file.

    [session]
    secure = “yes”
    module = “session”
    action = “index”

    All pages included this block in security.ini will be secured automatically. If you’re an authenticated user will see the page but if you’re not you will redirect to login page. You need to modify module and action parameters to set your login page.