Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Saturday, September 27, 2008

Syntax Highlight/Format C#, Java, PHP Code in Blogger

The method I used to put syntax highlighted code in my blog is to use the "Code Format" tool provided by Manoli.net. It works fine but I am just lazy to convert my code every time I post a new entry.

I then try to find another solution. One option is to use SyntaxHighlighter, a Java Script library that does all the syntax highlight jobs for you.

After installation, one problem I faced is that all the "new line" I wrote in "Edit Html" of Compose Page in Blogger are converted to "
". That's not very nice : (

Like everytime, I performed a search and found a good solution here, Using SyntaxHighlighter on BLOGGER. The purpose of additional script is to convert all the "
" found in the code to "new line" chracter. It works fine and here is my sample of highlighted Java code.

(Of course, I will not use silly program like Hello World for this :D )

And here is the result:



Simple, isn't it ?

Sunday, August 5, 2007

Unwritable session save path in Joomla setup

I found a good fix at http://forum.mamboserver.com/showthread.php?t=12800 by Yohan. Thanks :)

My environment is PHP 4.40 with IIS 5.1 on Windows XP. First, I created new directory and named it sessionsave at C:\php\sessionsave. After that, I changed this directory permission to enable the IUSR_machinename to have full control over it.




Note: If you cannot find Security tab in your Windows XP system. You can enable it by go to the Tools -> Folder Options ... -> View -> remove the tick in front of "Use simple file sharing". Windows Server family enable this by default.

Finally, I edited my php.ini file. Back to the setup, Joomla can now write to the session save path.

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
; As of PHP 4.0.1, you can define the path as:
session.save_path = "C:\php\sessionsave\"

PHP with IIS error: The page cannot be found

Recently, I mangled up my IIS's wwwrooot directory. So I had to create a new one.

Today, I need to install Joomla, one of popular PHP CMS applications. But when I copied the package to my new wwwroot and browse to http://localhost/GearGame ("GearGame" is my project's name) the web server return me the 404 error. I am running PHP 4.40 with IIS 5.1 on Windows XP.



After some experiments, I found that I cannot run any PHP file. So I consult the PHP's readme file and found these lines:

The following steps are optional:

* Edit your new php.ini file. If you plan to use OmniHTTPd, do not
follow the next step. Set the doc_root to point to your web
servers document_root. For example:

doc_root = c:\inetpub\wwwroot // for IIS/PWS

doc_root = c:\apache\htdocs // for Apache

Then, I browse to my php.ini file located at C:\Windows\php.ini and edit the doc_root to my new wwwroot.

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
doc_root = C:\wroot

I finally refresh the page, I can setup my Joomla now.